diff --git a/output/luaScripts/Emugators_HelloWorld.lua b/output/luaScripts/Emugators_HelloWorld.lua index 2eda165a..b3549bd7 100644 --- a/output/luaScripts/Emugators_HelloWorld.lua +++ b/output/luaScripts/Emugators_HelloWorld.lua @@ -1,10 +1,14 @@ - emu.print("okay, but where does this one go?") - local y = 6 + emu.print("Go Gators!") + local y = 0 + while(true) do gui.drawtext(0, y, "Hello World") - y = y + 1 - soup("this is cool") - emugator.yieldwithflag(); - + if(y < 256) then + y = y + 1 + else + y = 0 + end + print(y) + emugator.yieldwithflag(); -- call this if you want the script to run without emulation (game running) --emu.frameadvance() end \ No newline at end of file diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 3f550b12..04a71586 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -965,18 +965,17 @@ doloopy: RedrawWindow(hAppWnd,0,0,RDW_ERASE|RDW_INVALIDATE); } else if (luaYieldFlag) { - RedrawWindow(hAppWnd, 0, 0, RDW_ERASE | RDW_VALIDATE); - - while (luaYieldFlag && !exiting) { - UpdateFCEUWindow(); + FCEUI_ResetPalette(); + while (luaYieldFlag && !exiting && !GameInfo) { luaYieldFlag = false; + UpdateFCEUWindow(); UpdateRawInputAndHotkeys(); uint8* gfx = 0; FCEUI_AdvanceNoFrame(&gfx); FCEUD_BlitScreen(gfx); - Sleep(50); + Sleep(25); } } else { diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 036eee17..9cb516ad 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -1167,6 +1167,7 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent) updateGameDependentMenus(); updateGameDependentMenusDebugger(); EmulationPaused = oldPaused; + return true; } @@ -2703,7 +2704,7 @@ void ByebyeWindow() DestroyWindow(hAppWnd); } -/// reates the main window. +/// Creates the main window. /// @return Flag that indicates failure (0) or success (1) int CreateMainWindow() { diff --git a/src/fceu.cpp b/src/fceu.cpp index 3723a5d5..1c201f76 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -478,7 +478,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen if (fp->archiveFilename != "") GameInfo->archiveFilename = strdup(fp->archiveFilename.c_str()); GameInfo->archiveCount = fp->archiveCount; - + GameInfo->soundchan = 0; GameInfo->soundrate = 0; GameInfo->name = 0; @@ -487,7 +487,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen GameInfo->input[0] = GameInfo->input[1] = SI_UNSET; GameInfo->inputfc = SIFC_UNSET; GameInfo->cspecial = SIS_NONE; - + //try to load each different format bool FCEUXLoad(const char *name, FCEUFILE * fp); @@ -556,7 +556,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen } if (GameInfo->type != GIT_NSF && !disableAutoLSCheats) - FCEU_LoadGameCheats(0); + //FCEU_LoadGameCheats(0); if (AutoResumePlay) { @@ -886,6 +886,10 @@ void FCEUI_AdvanceNoFrame(uint8** pXBuf) { *pXBuf = XBuf; } +void FCEUI_ResetPalette(void) { + FCEU_ResetPalette(); +} + void FCEUI_CloseGame(void) { if (!FCEU_IsValidUI(FCEUI_CLOSEGAME)) return; diff --git a/src/fceu.h b/src/fceu.h index 1d302911..90e0b1ef 100644 --- a/src/fceu.h +++ b/src/fceu.h @@ -151,8 +151,10 @@ void SetNESDeemph_OldHacky(uint8 d, int force); void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor); void FCEU_PutImage(void); -void FCEUI_AdvanceNoFrame(uint8** pXBuf); // - emugator -void FCEU_ClearScreen(void); // -emugator +// - emugator +void FCEUI_AdvanceNoFrame(uint8** pXBuf); +void FCEU_ClearScreen(void); +void FCEUI_ResetPalette(void); #ifdef FRAMESKIP void FCEU_PutImageDummy(void); diff --git a/src/ines.cpp b/src/ines.cpp index 92fa0bdf..96caf1ab 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -940,9 +940,9 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) { trainerpoo = NULL; ExtraNTARAM = NULL; return LOADER_HANDLED_ERROR; - + init_ok: - + GameInfo->mappernum = MapperNo; FCEU_LoadGameSave(&iNESCart); diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 32a81f89..91f862d2 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -6469,7 +6469,6 @@ int FCEU_LoadLuaCode(const char *filename, const char *arg) // register a few utility functions outside of libraries (in the global namespace) lua_register(L, "print", print); - lua_register(L, "soup", print); //emugatordebug lua_register(L, "gethash", gethash), lua_register(L, "tostring", tostring); lua_register(L, "tobitstring", tobitstring); diff --git a/src/palette.cpp b/src/palette.cpp index 35280df1..dfbff360 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -71,6 +71,7 @@ static pal *default_palette[8]= static void CalculatePalette(void); static void ChoosePalette(void); static void WritePalette(void); +static void UseDefaultPalette(void); //points to the actually selected current palette pal *palo = NULL; @@ -500,6 +501,11 @@ void FCEU_ResetPalette(void) ChoosePalette(); WritePalette(); } + else if (luaYieldFlag) { + UseDefaultPalette(); + WritePalette(); + } + } static void ChoosePalette(void) @@ -552,6 +558,12 @@ static void ChoosePalette(void) } } +static void UseDefaultPalette(void) { + palo = default_palette[default_palette_selection]; + //need to calcualte a deemph on the fly.. sorry. maybe support otherwise later + ApplyDeemphasisComplete(palo); +} + void WritePalette(void) { int x;