Skip to content

Commit

Permalink
Merge pull request #2 from LionsAd/revert-1-snes9x-rr-unix-lua
Browse files Browse the repository at this point in the history
Revert "[WIP] First attempt for bringing lua back to unix."
  • Loading branch information
gocha committed Mar 16, 2015
2 parents a5853e1 + 1b5ddee commit 007915b
Show file tree
Hide file tree
Showing 7 changed files with 5,054 additions and 2,932 deletions.
38 changes: 6 additions & 32 deletions lua-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,6 @@
//#define strrchr strrchrA
#endif

#else // __WIN32

#define FORCEINLINE __inline__ __attribute__((always_inline))
#define ENSURE_FORCEINLINE __attribute__((always_inline)) // inline or die

int vscprintf (const char * format, va_list pargs)
{
int retval;
va_list argcopy;
va_copy(argcopy, pargs);
retval = vsnprintf(NULL, 0, format, argcopy);
va_end(argcopy);
return retval;
}

#define MAX_PATH PATH_MAX
#define _chdir chdir

#endif

bool g_disableStatestateWarnings = false;
Expand Down Expand Up @@ -207,7 +189,7 @@ static const char* luaCallIDStrings [] =
"CALL_HOTKEY_15",
"CALL_HOTKEY_16",
};
static int _makeSureWeHaveTheRightNumberOfStrings [sizeof(luaCallIDStrings)/sizeof(*luaCallIDStrings) == LUACALL_COUNT ? 1 : 0];
static const int _makeSureWeHaveTheRightNumberOfStrings [sizeof(luaCallIDStrings)/sizeof(*luaCallIDStrings) == LUACALL_COUNT ? 1 : 0];

static const char* luaMemHookTypeStrings [] =
{
Expand All @@ -219,7 +201,7 @@ static const char* luaMemHookTypeStrings [] =
"MEMHOOK_READ_SUB",
"MEMHOOK_EXEC_SUB",
};
static int _makeSureWeHaveTheRightNumberOfStrings2 [sizeof(luaMemHookTypeStrings)/sizeof(*luaMemHookTypeStrings) == LUAMEMHOOK_COUNT ? 1 : 0];
static const int _makeSureWeHaveTheRightNumberOfStrings2 [sizeof(luaMemHookTypeStrings)/sizeof(*luaMemHookTypeStrings) == LUAMEMHOOK_COUNT ? 1 : 0];

void StopScriptIfFinished(int uid, bool justReturned = false);
void SetSaveKey(LuaContextInfo& info, const char* key);
Expand Down Expand Up @@ -795,8 +777,6 @@ void CallDeferredFunctions(lua_State* L, const char* idstring)

bool DeferGUIFuncIfNeeded(lua_State* L)
{
return false;

LuaContextInfo& info = GetCurrentInfo();
if(info.speedMode == SPEEDMODE_MAXIMUM)
{
Expand Down Expand Up @@ -1667,9 +1647,9 @@ DEFINE_LUA_FUNCTION(emu_wait, "")



/*
DEFINE_LUA_FUNCTION(emu_frameadvance, "")
{
/*
if(FailVerifyAtFrameBoundary(L, "emu.frameadvance", 0,1))
return emu_wait(L);
Expand Down Expand Up @@ -1706,12 +1686,8 @@ DEFINE_LUA_FUNCTION(emu_frameadvance, "")
emu_emulateframeinvisible(L);
break;
}
*/
S9xMainLoop();
S9xProcessEvents(FALSE);

return 0;
}
}*/

DEFINE_LUA_FUNCTION(emu_pause, "")
{
Expand Down Expand Up @@ -4582,7 +4558,7 @@ static int gcStateData(lua_State *L)

static const struct luaL_reg emulib [] =
{
{"frameadvance", emu_frameadvance},
// {"frameadvance", emu_frameadvance},
// {"speedmode", emu_speedmode},
// {"wait", emu_wait},
{"pause", emu_pause},
Expand Down Expand Up @@ -5470,13 +5446,11 @@ struct TieredRegion

bool Contains(unsigned int address, int size) const
{
/*
std::vector<Island>::const_iterator iter = islands.begin();
std::vector<Island>::const_iterator end = islands.end();
for(; iter != end; ++iter)
if(iter->Contains(address, size))
return true;
*/
return false;
}
};
Expand All @@ -5496,7 +5470,7 @@ struct TieredRegion

TieredRegion()
{
//Calculate(std::vector<unsigned int>());
Calculate(std::vector<unsigned int>());
}

__forceinline int NotEmpty()
Expand Down
1 change: 0 additions & 1 deletion lua-engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#ifndef LUA_SCRIPT_H
#define LUA_SCRIPT_H

#include "jma/portable.h"

void OpenLuaContext(int uid, void(*print)(int uid, const char* str) = 0, void(*onstart)(int uid) = 0, void(*onstop)(int uid, bool statusOK) = 0);
void RunLuaScriptFile(int uid, const char* filename);
Expand Down
5 changes: 0 additions & 5 deletions snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@
#include "lua-engine.h"
#endif

// Hack: MAX_PATH is not defined on unix.
#ifndef MAX_PATH
#define MAX_PATH PATH_MAX
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
Expand Down
4 changes: 2 additions & 2 deletions unix/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
OS = `uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"`
BUILDDIR = .

OBJECTS = ../apu/apu.o ../apu/bapu/dsp/sdsp.o ../apu/bapu/dsp/SPC_DSP.o ../apu/bapu/smp/smp.o ../apu/bapu/smp/smp_state.o ../bsx.o ../c4.o ../c4emu.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../fxinst.o ../fxemu.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../movie.o ../obc1.o ../ppu.o ../stream.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o ../statemanager.o unix.o x11.o ../lua-engine.o
OBJECTS = ../apu/apu.o ../apu/bapu/dsp/sdsp.o ../apu/bapu/dsp/SPC_DSP.o ../apu/bapu/smp/smp.o ../apu/bapu/smp/smp_state.o ../bsx.o ../c4.o ../c4emu.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../fxinst.o ../fxemu.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../movie.o ../obc1.o ../ppu.o ../stream.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o ../statemanager.o unix.o x11.o
DEFS = -DMITSHM

ifdef S9XDEBUGGER
Expand All @@ -29,7 +29,7 @@ endif
CCC = @CXX@
CC = @CC@
GASM = @CXX@
INCLUDES = -I. -I.. -I../apu/ -I../apu/bapu -I../unzip/ -I../jma/ -I../filter/ -Ilua-5.1.5/src/
INCLUDES = -I. -I.. -I../apu/ -I../apu/bapu -I../unzip/ -I../jma/ -I../filter/

CCFLAGS = @S9XFLGS@ @S9XDEFS@ $(DEFS)
CFLAGS = $(CCFLAGS)
Expand Down
Loading

0 comments on commit 007915b

Please sign in to comment.