Lua: Fix type confusion between signed and unsigned
[lsnes.git] / include / interface / c-interface-translate.hpp
blob25113502d1af51dafec40def55969527eb96494f
1 #ifndef _interface__c_interface_translate__hpp__included__
2 #define _interface__c_interface_translate__hpp__included__
4 /*
6 Copyright (c) 2014 Ilari Liusvaara
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
28 #include "c-interface.h"
30 namespace lsnes_interface
32 template<int num> class e2t {};
33 template<> struct e2t<LSNES_CORE_ENUMERATE_CORES> {
34 typedef lsnes_core_enumerate_cores* t;
35 typedef lsnes_core_enumerate_cores& r;
37 template<> struct e2t<LSNES_CORE_GET_CORE_INFO> {
38 typedef lsnes_core_get_core_info* t;
39 typedef lsnes_core_get_core_info& r;
41 template<> struct e2t<LSNES_CORE_GET_TYPE_INFO> {
42 typedef lsnes_core_get_type_info* t;
43 typedef lsnes_core_get_type_info& r;
45 template<> struct e2t<LSNES_CORE_GET_REGION_INFO> {
46 typedef lsnes_core_get_region_info* t;
47 typedef lsnes_core_get_region_info& r;
49 template<> struct e2t<LSNES_CORE_GET_SYSREGION_INFO> {
50 typedef lsnes_core_get_sysregion_info* t;
51 typedef lsnes_core_get_sysregion_info& r;
53 template<> struct e2t<LSNES_CORE_GET_AV_STATE> {
54 typedef lsnes_core_get_av_state* t;
55 typedef lsnes_core_get_av_state& r;
57 template<> struct e2t<LSNES_CORE_EMULATE> {
58 typedef lsnes_core_emulate* t;
59 typedef lsnes_core_emulate& r;
61 template<> struct e2t<LSNES_CORE_SAVESTATE> {
62 typedef lsnes_core_savestate* t;
63 typedef lsnes_core_savestate& r;
65 template<> struct e2t<LSNES_CORE_LOADSTATE> {
66 typedef lsnes_core_loadstate* t;
67 typedef lsnes_core_loadstate& r;
69 template<> struct e2t<LSNES_CORE_GET_CONTROLLERCONFIG> {
70 typedef lsnes_core_get_controllerconfig* t;
71 typedef lsnes_core_get_controllerconfig& r;
73 template<> struct e2t<LSNES_CORE_LOAD_ROM> {
74 typedef lsnes_core_load_rom* t;
75 typedef lsnes_core_load_rom& r;
77 template<> struct e2t<LSNES_CORE_GET_REGION> {
78 typedef lsnes_core_get_region* t;
79 typedef lsnes_core_get_region& r;
81 template<> struct e2t<LSNES_CORE_SET_REGION> {
82 typedef lsnes_core_set_region* t;
83 typedef lsnes_core_set_region& r;
85 template<> struct e2t<LSNES_CORE_DEINITIALIZE> {
86 typedef lsnes_core_deinitialize* t;
87 typedef lsnes_core_deinitialize& r;
89 template<> struct e2t<LSNES_CORE_GET_PFLAG> {
90 typedef lsnes_core_get_pflag* t;
91 typedef lsnes_core_get_pflag& r;
93 template<> struct e2t<LSNES_CORE_SET_PFLAG> {
94 typedef lsnes_core_set_pflag* t;
95 typedef lsnes_core_set_pflag& r;
97 template<> struct e2t<LSNES_CORE_GET_ACTION_FLAGS> {
98 typedef lsnes_core_get_action_flags* t;
99 typedef lsnes_core_get_action_flags& r;
101 template<> struct e2t<LSNES_CORE_EXECUTE_ACTION> {
102 typedef lsnes_core_execute_action* t;
103 typedef lsnes_core_execute_action& r;
105 template<> struct e2t<LSNES_CORE_GET_BUS_MAPPING> {
106 typedef lsnes_core_get_bus_mapping* t;
107 typedef lsnes_core_get_bus_mapping& r;
109 template<> struct e2t<LSNES_CORE_ENUMERATE_SRAM> {
110 typedef lsnes_core_enumerate_sram* t;
111 typedef lsnes_core_enumerate_sram& r;
113 template<> struct e2t<LSNES_CORE_SAVE_SRAM> {
114 typedef lsnes_core_save_sram* t;
115 typedef lsnes_core_save_sram& r;
117 template<> struct e2t<LSNES_CORE_LOAD_SRAM> {
118 typedef lsnes_core_load_sram* t;
119 typedef lsnes_core_load_sram& r;
121 template<> struct e2t<LSNES_CORE_GET_RESET_ACTION> {
122 typedef lsnes_core_get_reset_action* t;
123 typedef lsnes_core_get_reset_action& r;
125 template<> struct e2t<LSNES_CORE_COMPUTE_SCALE> {
126 typedef lsnes_core_compute_scale* t;
127 typedef lsnes_core_compute_scale& r;
129 template<> struct e2t<LSNES_CORE_RUNTOSAVE> {
130 typedef lsnes_core_runtosave* t;
131 typedef lsnes_core_runtosave& r;
133 template<> struct e2t<LSNES_CORE_POWERON> {
134 typedef lsnes_core_poweron* t;
135 typedef lsnes_core_poweron& r;
137 template<> struct e2t<LSNES_CORE_UNLOAD_CARTRIDGE> {
138 typedef lsnes_core_unload_cartridge* t;
139 typedef lsnes_core_unload_cartridge& r;
141 template<> struct e2t<LSNES_CORE_DEBUG_RESET> {
142 typedef lsnes_core_debug_reset* t;
143 typedef lsnes_core_debug_reset& r;
145 template<> struct e2t<LSNES_CORE_SET_DEBUG_FLAGS> {
146 typedef lsnes_core_set_debug_flags* t;
147 typedef lsnes_core_set_debug_flags& r;
149 template<> struct e2t<LSNES_CORE_SET_CHEAT> {
150 typedef lsnes_core_set_cheat* t;
151 typedef lsnes_core_set_cheat& r;
153 template<> struct e2t<LSNES_CORE_DRAW_COVER> {
154 typedef lsnes_core_draw_cover* t;
155 typedef lsnes_core_draw_cover& r;
157 template<> struct e2t<LSNES_CORE_PRE_EMULATE> {
158 typedef lsnes_core_pre_emulate* t;
159 typedef lsnes_core_pre_emulate& r;
161 template<> struct e2t<LSNES_CORE_GET_DEVICE_REGS> {
162 typedef lsnes_core_get_device_regs* t;
163 typedef lsnes_core_get_device_regs& r;
165 template<> struct e2t<LSNES_CORE_GET_VMA_LIST> {
166 typedef lsnes_core_get_vma_list* t;
167 typedef lsnes_core_get_vma_list& r;
169 template<> struct e2t<LSNES_CORE_REINIT> {
170 typedef lsnes_core_reinit* t;
171 typedef lsnes_core_reinit& r;
174 template<typename T> class t2e {};
175 template<> struct t2e<lsnes_core_enumerate_cores> { const static int e = LSNES_CORE_ENUMERATE_CORES; };
176 template<> struct t2e<lsnes_core_get_core_info> { const static int e = LSNES_CORE_GET_CORE_INFO; };
177 template<> struct t2e<lsnes_core_get_type_info> { const static int e = LSNES_CORE_GET_TYPE_INFO; };
178 template<> struct t2e<lsnes_core_get_region_info> { const static int e = LSNES_CORE_GET_REGION_INFO; };
179 template<> struct t2e<lsnes_core_get_sysregion_info> { const static int e = LSNES_CORE_GET_SYSREGION_INFO; };
180 template<> struct t2e<lsnes_core_get_av_state> { const static int e = LSNES_CORE_GET_AV_STATE; };
181 template<> struct t2e<lsnes_core_emulate> { const static int e = LSNES_CORE_EMULATE; };
182 template<> struct t2e<lsnes_core_savestate> { const static int e = LSNES_CORE_SAVESTATE; };
183 template<> struct t2e<lsnes_core_loadstate> { const static int e = LSNES_CORE_LOADSTATE; };
184 template<> struct t2e<lsnes_core_get_controllerconfig> { const static int e = LSNES_CORE_GET_CONTROLLERCONFIG; };
185 template<> struct t2e<lsnes_core_load_rom> { const static int e = LSNES_CORE_LOAD_ROM; };
186 template<> struct t2e<lsnes_core_get_region> { const static int e = LSNES_CORE_GET_REGION; };
187 template<> struct t2e<lsnes_core_set_region> { const static int e = LSNES_CORE_SET_REGION; };
188 template<> struct t2e<lsnes_core_deinitialize> { const static int e = LSNES_CORE_DEINITIALIZE; };
189 template<> struct t2e<lsnes_core_get_pflag> { const static int e = LSNES_CORE_GET_PFLAG; };
190 template<> struct t2e<lsnes_core_set_pflag> { const static int e = LSNES_CORE_SET_PFLAG; };
191 template<> struct t2e<lsnes_core_get_action_flags> { const static int e = LSNES_CORE_GET_ACTION_FLAGS; };
192 template<> struct t2e<lsnes_core_execute_action> { const static int e = LSNES_CORE_EXECUTE_ACTION; };
193 template<> struct t2e<lsnes_core_get_bus_mapping> { const static int e = LSNES_CORE_GET_BUS_MAPPING; };
194 template<> struct t2e<lsnes_core_enumerate_sram> { const static int e = LSNES_CORE_ENUMERATE_SRAM; };
195 template<> struct t2e<lsnes_core_save_sram> { const static int e = LSNES_CORE_SAVE_SRAM; };
196 template<> struct t2e<lsnes_core_load_sram> { const static int e = LSNES_CORE_LOAD_SRAM; };
197 template<> struct t2e<lsnes_core_get_reset_action> { const static int e = LSNES_CORE_GET_RESET_ACTION; };
198 template<> struct t2e<lsnes_core_compute_scale> { const static int e = LSNES_CORE_COMPUTE_SCALE; };
199 template<> struct t2e<lsnes_core_runtosave> { const static int e = LSNES_CORE_RUNTOSAVE; };
200 template<> struct t2e<lsnes_core_poweron> { const static int e = LSNES_CORE_POWERON; };
201 template<> struct t2e<lsnes_core_unload_cartridge> { const static int e = LSNES_CORE_UNLOAD_CARTRIDGE; };
202 template<> struct t2e<lsnes_core_debug_reset> { const static int e = LSNES_CORE_DEBUG_RESET; };
203 template<> struct t2e<lsnes_core_set_debug_flags> { const static int e = LSNES_CORE_SET_DEBUG_FLAGS; };
204 template<> struct t2e<lsnes_core_set_cheat> { const static int e = LSNES_CORE_SET_CHEAT; };
205 template<> struct t2e<lsnes_core_draw_cover> { const static int e = LSNES_CORE_DRAW_COVER; };
206 template<> struct t2e<lsnes_core_pre_emulate> { const static int e = LSNES_CORE_PRE_EMULATE; };
207 template<> struct t2e<lsnes_core_get_device_regs> { const static int e = LSNES_CORE_GET_DEVICE_REGS; };
208 template<> struct t2e<lsnes_core_get_vma_list> { const static int e = LSNES_CORE_GET_VMA_LIST; };
209 template<> struct t2e<lsnes_core_reinit> { const static int e = LSNES_CORE_REINIT; };
212 #endif