Clean up system font drawing
[lsnes.git] / src / video / null.cpp
blob7adabe494fee7a54a005fa5265489603ca4435b1
1 #include "core/advdumper.hpp"
2 #include "core/dispatch.hpp"
3 #include "core/instance.hpp"
4 #include "core/moviedata.hpp"
5 #include "core/moviefile.hpp"
6 #include "core/messages.hpp"
7 #include "core/rom.hpp"
8 #include "library/serialization.hpp"
9 #include "library/minmax.hpp"
11 #include <iomanip>
12 #include <cassert>
13 #include <cstring>
14 #include <cerrno>
15 #include <cstring>
16 #include <sstream>
17 #include <fstream>
18 #include <zlib.h>
20 namespace
22 void deleter_fn(void* f)
24 delete reinterpret_cast<std::ofstream*>(f);
27 class null_dump_obj : public dumper_base
29 public:
30 null_dump_obj(master_dumper& _mdumper, dumper_factory_base& _fbase, const std::string& mode,
31 const std::string& prefix)
32 : dumper_base(_mdumper, _fbase), mdumper(_mdumper)
34 try {
35 mdumper.add_dumper(*this);
36 } catch(std::bad_alloc& e) {
37 throw;
38 } catch(std::exception& e) {
39 std::ostringstream x;
40 x << "Error starting NULL dump: " << e.what();
41 throw std::runtime_error(x.str());
44 ~null_dump_obj() throw()
46 mdumper.drop_dumper(*this);
48 void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d)
50 //Do nothing.
52 void on_sample(short l, short r)
54 //Do nothing.
56 void on_rate_change(uint32_t n, uint32_t d)
58 //Do nothing.
60 void on_gameinfo_change(const master_dumper::gameinfo& gi)
62 //Do nothing.
64 void on_end()
66 delete this;
68 private:
69 master_dumper& mdumper;
72 class adv_null_dumper : public dumper_factory_base
74 public:
75 adv_null_dumper() : dumper_factory_base("INTERNAL-NULL")
77 ctor_notify();
79 ~adv_null_dumper() throw();
80 std::set<std::string> list_submodes() throw(std::bad_alloc)
82 std::set<std::string> x;
83 return x;
85 unsigned mode_details(const std::string& mode) throw()
87 return target_type_special;
89 std::string mode_extension(const std::string& mode) throw()
91 return ""; //Nothing interesting.
93 std::string name() throw(std::bad_alloc)
95 return "NULL";
97 std::string modename(const std::string& mode) throw(std::bad_alloc)
99 return "";
101 null_dump_obj* start(master_dumper& _mdumper, const std::string& mode, const std::string& prefix)
102 throw(std::bad_alloc, std::runtime_error)
104 return new null_dump_obj(_mdumper, *this, mode, prefix);
106 bool hidden() const { return true; }
107 } adv;
109 adv_null_dumper::~adv_null_dumper() throw()