Some really (REALLY) old changes that were hanging on my computer for a while

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5091 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2010-02-20 09:36:22 +00:00
parent 154bc956ad
commit 2aa03f5b3b
2 changed files with 4807 additions and 4826 deletions

View File

@ -39,9 +39,7 @@ extern "C" {
#include "lstate.h" #include "lstate.h"
}; };
// TODO Count: 8 // TODO Count: 7
// TODO: GUI
#if defined(DEBUG) || defined(DEBUGFAST) #if defined(DEBUG) || defined(DEBUGFAST)
bool Debug = true; bool Debug = true;
@ -51,33 +49,6 @@ bool Debug = false;
namespace Lua { namespace Lua {
// the emulator must provide these so that we can implement
// the various functions the user can call from their lua script
// (this interface with the emulator needs cleanup, I know)
//extern unsigned int ReadValueAtHardwareAddress(unsigned int address, unsigned int size);
//extern bool WriteValueAtHardwareAddress(unsigned int address, unsigned int value, unsigned int size, bool hookless=false);
//extern bool WriteValueAtHardwareRAMAddress(unsigned int address, unsigned int value, unsigned int size, bool hookless=false);
//extern bool WriteValueAtHardwareROMAddress(unsigned int address, unsigned int value, unsigned int size);
//extern bool IsHardwareAddressValid(unsigned int address);
//extern bool IsHardwareRAMAddressValid(unsigned int address);
//extern bool IsHardwareROMAddressValid(unsigned int address);
//extern int Clear_Sound_Buffer(void);
//extern long long GetCurrentInputCondensed();
//extern long long PeekInputCondensed();
//extern void SetNextInputCondensed(long long input, long long mask);
//extern int Set_Current_State(int Num, bool showOccupiedMessage, bool showEmptyMessage);
//extern int Update_Emulation_One(HWND hWnd);
//extern void Update_Emulation_One_Before(HWND hWnd);
//extern void Update_Emulation_After_Fast(HWND hWnd);
//extern void Update_Emulation_One_Before_Minimal();
//extern int Update_Frame_Adjusted();
//extern int Update_Frame_Hook();
//extern int Update_Frame_Fast_Hook();
//extern void Update_Emulation_After_Controlled(HWND hWnd, bool flip);
//extern void Prevent_Next_Frame_Skipping();
//extern void UpdateLagCount();
//extern bool Step_emulua_MainLoop(bool allowSleep, bool allowEmulate);
int disableSound2, disableRamSearchUpdate; int disableSound2, disableRamSearchUpdate;
bool BackgroundInput; bool BackgroundInput;
bool g_disableStatestateWarnings; bool g_disableStatestateWarnings;
@ -1018,6 +989,7 @@ DEFINE_LUA_FUNCTION(print, "...")
DEFINE_LUA_FUNCTION(emulua_message, "str") DEFINE_LUA_FUNCTION(emulua_message, "str")
{ {
const char* str = toCString(L); const char* str = toCString(L);
if(Core::isRunning())
Core::DisplayMessage(str, 2000); Core::DisplayMessage(str, 2000);
return 0; return 0;
} }
@ -1185,13 +1157,14 @@ void LuaRescueHook(lua_State* L, lua_Debug *dbg)
info.worryCount = 0; info.worryCount = 0;
info.stopWorrying = false; info.stopWorrying = false;
bool stoprunning = true; bool stoprunning = info.panic;
bool stopworrying = true; bool stopworrying = true;
if(!info.panic) /*if(!info.panic)
{ {
if(Core::isRunning())
CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer(); CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer();
stoprunning = PanicYesNo("A Lua script has been running for quite a while. Maybe it is in an infinite loop.\n\nWould you like to stop the script?\n\n(Yes to stop it now,\n No to keep running and not ask again)"); stoprunning = PanicYesNo("A Lua script has been running for quite a while. Maybe it is in an infinite loop.\n\nWould you like to stop the script?\n\n(Yes to stop it now,\n No to keep running and not ask again)");
} }*/
if(!stoprunning && stopworrying) if(!stoprunning && stopworrying)
{ {
@ -1203,7 +1176,6 @@ void LuaRescueHook(lua_State* L, lua_Debug *dbg)
{ {
//lua_sethook(L, NULL, 0, 0); //lua_sethook(L, NULL, 0, 0);
assert(L->errfunc || L->errorJmp); assert(L->errfunc || L->errorJmp);
luaL_error(L, info.panic ? info.panicMessage : "terminated by user");
} }
info.panic = false; info.panic = false;
@ -1371,17 +1343,20 @@ DEFINE_LUA_FUNCTION(emulua_frameadvance, "")
if(FailVerifyAtFrameBoundary(L, "emulua.frameadvance", 0,1)) if(FailVerifyAtFrameBoundary(L, "emulua.frameadvance", 0,1))
return emulua_wait(L); return emulua_wait(L);
if(Core::GetState() == Core::CORE_UNINITIALIZED || Core::GetState() == Core::CORE_STOPPING)
return emulua_wait(L);
int uid = luaStateToUIDMap[L]; int uid = luaStateToUIDMap[L];
LuaContextInfo& info = GetCurrentInfo(); LuaContextInfo& info = GetCurrentInfo();
if(!info.ranFrameAdvance) {
info.ranFrameAdvance = true; info.ranFrameAdvance = true;
Frame::SetFrameStepping(info.ranFrameAdvance); Frame::SetFrameStepping(true);
}
// Should step exactly one frame // Should step exactly one frame
Core::SetState(Core::CORE_RUN); Core::SetState(Core::CORE_RUN);
//while(Core::GetState() != Core::CORE_PAUSE && !info.panic);
return 0; return 0;
} }
@ -2907,6 +2882,7 @@ DEFINE_LUA_FUNCTION(movie_close, "")
DEFINE_LUA_FUNCTION(sound_clear, "") DEFINE_LUA_FUNCTION(sound_clear, "")
{ {
if(CPluginManager::GetInstance().GetDSP())
CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer(); CPluginManager::GetInstance().GetDSP()->DSP_ClearAudioBuffer();
return 0; return 0;
} }
@ -3589,6 +3565,7 @@ void RequestAbortLuaScript(int uid, const char* message)
// and this works pretty well and is definitely safe, so screw it // and this works pretty well and is definitely safe, so screw it
info.L->hookcount = 1; // run hook function as soon as possible info.L->hookcount = 1; // run hook function as soon as possible
info.panic = true; // and call luaL_error once we're inside the hook function info.panic = true; // and call luaL_error once we're inside the hook function
if(message) if(message)
{ {
strncpy(info.panicMessage, message, sizeof(info.panicMessage)); strncpy(info.panicMessage, message, sizeof(info.panicMessage));
@ -3750,6 +3727,9 @@ void StopLuaScript(int uid)
LuaContextInfo& info = *infoPtr; LuaContextInfo& info = *infoPtr;
if(info.ranFrameAdvance)
Frame::SetFrameStepping(false);
if(info.running) if(info.running)
{ {
// if it's currently running then we can't stop it now without crashing // if it's currently running then we can't stop it now without crashing

View File

@ -548,6 +548,7 @@ void addr(const UDSPInstruction& opc)
// SUBR $acD.M, $axS.L // SUBR $acD.M, $axS.L
// 0101 0ssd xxxx xxxx // 0101 0ssd xxxx xxxx
// Subtracts register $axS.L from accumulator $acD.M register. // Subtracts register $axS.L from accumulator $acD.M register.
// NOTE: It is seen in DSP_UCODE_ZELDA that AXs.H can also be subtracted
void subr(const UDSPInstruction& opc) void subr(const UDSPInstruction& opc)
{ {
u8 areg = (opc.hex >> 8) & 0x1; u8 areg = (opc.hex >> 8) & 0x1;