Namespace library port-controller stuff
[lsnes.git] / include / library / portctrl-parse.hpp
blobf63da1fb8a8d905acd6cdbe776b7215be9d2014a
1 #ifndef _library__portctrl_parse__hpp__included__
2 #define _library__portctrl_parse__hpp__included__
4 #include "assembler.hpp"
6 namespace JSON
8 class node;
11 namespace portctrl
13 class controller_set;
14 class type;
16 struct controller_set* pcs_from_json(const JSON::node& root, const std::string& ptr);
17 std::vector<controller_set*> pcs_from_json_array(const JSON::node& root, const std::string& ptr);
18 std::string pcs_write_class(const struct controller_set& pset, unsigned& tmp_idx);
19 std::string pcs_write_trailer(const std::vector<controller_set*>& p);
20 std::string pcs_write_classes(const std::vector<controller_set*>& p, unsigned& tmp_idx);
22 struct type_generic : public type
24 type_generic(const JSON::node& root, const std::string& ptr) throw(std::exception);
25 ~type_generic() throw();
26 struct ser_instruction
28 int type;
29 void* djumpvector;
30 void* ejumpvector;
31 size_t offset;
32 unsigned char mask;
33 char character;
35 struct idxinfo
37 int type;
38 size_t offset;
39 unsigned char mask;
40 unsigned char imask;
41 int controller;
42 int index;
44 private:
45 std::vector<size_t> indexbase;
46 std::vector<idxinfo> indexinfo;
47 void* dyncode_block;
48 mutable std::vector<ser_instruction> serialize_instructions;
49 std::string port_iname(const JSON::node& root, const std::string& ptr);
50 std::string port_hname(const JSON::node& root, const std::string& ptr);
51 size_t port_size(const JSON::node& root, const std::string& ptr);
52 static void _write(const type* _this, unsigned char* buffer, unsigned idx, unsigned ctrl, short x);
53 static short _read(const type* _this, const unsigned char* buffer, unsigned idx, unsigned ctrl);
54 static size_t _serialize(const type* _this, const unsigned char* buffer, char* textbuf);
55 static size_t _deserialize(const type* _this, unsigned char* buffer, const char* textbuf);
56 void make_dynamic_blocks();
57 void make_routines(assembler::assembler& a, assembler::label_list& labels);
61 #endif