MCPcopy Create free account
hub / github.com/WilliamLCobb/iNDS / MatchHookTypeToCPU

Function MatchHookTypeToCPU

desmume/src/lua-engine.cpp:289–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289LuaMemHookType MatchHookTypeToCPU(lua_State* L, LuaMemHookType hookType)
290{
291 int cpuID = 0;
292
293 int cpunameIndex = 0;
294 if(lua_type(L,2) == LUA_TSTRING)
295 cpunameIndex = 2;
296 else if(lua_type(L,3) == LUA_TSTRING)
297 cpunameIndex = 3;
298
299 if(cpunameIndex)
300 {
301 const char* cpuName = lua_tostring(L, cpunameIndex);
302// if(!stricmp(cpuName, "sub") || !stricmp(cpuName, "s68k"))
303// cpuID = 1;
304 lua_remove(L, cpunameIndex);
305 }
306
307// switch(cpuID)
308// {
309// case 0: // m68k:
310// return hookType;
311//
312// case 1: // s68k:
313// switch(hookType)
314// {
315// case LUAMEMHOOK_WRITE: return LUAMEMHOOK_WRITE_SUB;
316// case LUAMEMHOOK_READ: return LUAMEMHOOK_READ_SUB;
317// case LUAMEMHOOK_EXEC: return LUAMEMHOOK_EXEC_SUB;
318// }
319// }
320 return hookType;
321}
322
323DEFINE_LUA_FUNCTION(memory_registerwrite, "address,[size=1,][cpuname=\"main\",]func")
324{

Callers 1

lua-engine.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected