diff --git a/src/drivers/win/debuggersp.cpp b/src/drivers/win/debuggersp.cpp index 018c084f..940f3605 100644 --- a/src/drivers/win/debuggersp.cpp +++ b/src/drivers/win/debuggersp.cpp @@ -63,7 +63,6 @@ char temp_chr[40] = {0}; char delimiterChar[2] = "#"; extern INT_PTR CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern char bookmarkDescription[]; MemoryMappedRegister RegNames[] = { {"$2000", "PPU_CTRL"}, @@ -857,10 +856,10 @@ void NameDebuggerBookmark(HWND hwnd) return; } else { + char bookmarkDescription[51] = { 0 }; if (bookmarks_name[selectedItem].size()) - { strcpy(bookmarkDescription, bookmarks_name[selectedItem].c_str()); - } else + else { bookmarkDescription[0] = 0; // try to find the same address in bookmarks @@ -874,7 +873,7 @@ void NameDebuggerBookmark(HWND hwnd) } } // Show the bookmark name dialog - if (DialogBox(fceu_hInstance, "NAMEBOOKMARKDLG", hwnd, nameBookmarkCallB)) + if (DialogBoxParam(fceu_hInstance, "NAMEBOOKMARKDLG", hwnd, nameBookmarkCallB, (LPARAM)bookmarkDescription)) { // Rename the selected bookmark bookmarks_name[selectedItem] = bookmarkDescription; diff --git a/src/drivers/win/header_editor.cpp b/src/drivers/win/header_editor.cpp index 9b43a7db..6c55525a 100644 --- a/src/drivers/win/header_editor.cpp +++ b/src/drivers/win/header_editor.cpp @@ -888,7 +888,6 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header) SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO)); return false; } - printf("mapper: %d\n", mapper); if (mapper < 4096) { @@ -1091,7 +1090,8 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header) return false; } } - else { + else + { MessageBox(hwnd, "PRG NVRAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR); SetFocus(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO)); return false; diff --git a/src/drivers/win/input.cpp b/src/drivers/win/input.cpp index edded8ea..3420e8b9 100644 --- a/src/drivers/win/input.cpp +++ b/src/drivers/win/input.cpp @@ -38,6 +38,10 @@ #include "sound.h" #include "keyscan.h" +#ifdef _S9XLUA_H +#include "fceulua.h" +#endif + LPDIRECTINPUT7 lpDI=0; void InitInputPorts(bool fourscore); @@ -71,6 +75,13 @@ static void PresetImport(int preset); static uint32 MouseData[3]; static int32 MouseRelative[3]; +#ifdef _S9XLUA_H +static uint32 LuaMouseData[3]; +#else +static uint32* const LuaMouseData = MouseData; +#endif + + //force the input types suggested by the game void ParseGIInput(FCEUGI *gi) { @@ -505,7 +516,13 @@ void FCEUD_UpdateInput() if(joy) UpdateGamepad(false); - if (mouse) GetMouseData(MouseData); + if (mouse) + { + GetMouseData(MouseData); + #ifdef _S9XLUA_H + FCEU_LuaReadZapper(MouseData, LuaMouseData); + #endif + } if (mouse_relative) GetMouseRelative(MouseRelative); } } @@ -553,7 +570,7 @@ void InitInputPorts(bool fourscore) InputDPtr=MouseData; break; case SI_ZAPPER: - InputDPtr=MouseData; + InputDPtr=LuaMouseData; break; case SI_MOUSE: InputDPtr=MouseRelative; diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 81030e70..e65d55aa 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -64,7 +64,9 @@ using namespace std; #define ID_ADDRESS_ADDBP_X 4 #define ID_ADDRESS_SEEK_IN_ROM 5 #define ID_ADDRESS_CREATE_GG_CODE 6 -#define ID_ADDRESS_BOOKMARK 20 +#define ID_ADDRESS_ADD_BOOKMARK 20 +#define ID_ADDRESS_REMOVE_BOOKMARK 21 +#define ID_ADDRESS_EDIT_BOOKMARK 22 #define ID_ADDRESS_SYMBOLIC_NAME 30 #define BOOKMARKS_SUBMENU_POS 4 @@ -122,11 +124,7 @@ popupmenu[] = {0x0000,0x3FFF, MODE_NES_PPU, ID_ADDRESS_ADDBP_W, "Add Debugger Write Breakpoint"}, {0x0000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_ADDBP_X, "Add Debugger Execute Breakpoint"}, {0x8000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_SEEK_IN_ROM, "Go Here In ROM File"}, - {0x8000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_CREATE_GG_CODE, "Create Game Genie Code At This Address"}, - {0x0000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_BOOKMARK, "Add / Remove bookmark"}, - {0x0000,0xFFFF, MODE_NES_PPU, ID_ADDRESS_BOOKMARK, "Add / Remove bookmark"}, - {0x0000,0xFFFF, MODE_NES_OAM, ID_ADDRESS_BOOKMARK, "Add / Remove bookmark"}, - {0x0000,0xFFFF, MODE_NES_FILE, ID_ADDRESS_BOOKMARK, "Add / Remove bookmark"}, + {0x8000,0xFFFF, MODE_NES_MEMORY, ID_ADDRESS_CREATE_GG_CODE, "Create Game Genie Code At This Address"} }; #define POPUPNUM (sizeof popupmenu / sizeof popupmenu[0]) @@ -849,7 +847,7 @@ void dumpToFile(const char* buffer, unsigned int size) bool loadFromFile(char* buffer, unsigned int size) { - char name[513] = {0}; + char name[513] = { 0 }; OPENFILENAME ofn; memset(&ofn, 0, sizeof(ofn)); @@ -914,8 +912,73 @@ void UnfreezeAllRam() { return; } +/* +int saveBookmarks(HWND hwnd) +{ + char name[513] = { 0 }; + OPENFILENAME ofn; + memset(&ofn, 0, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hInstance = fceu_hInstance; + ofn.lpstrTitle = "Save bookmarks as..."; + ofn.lpstrFilter = "Bookmark list (*.bld)\0*.lst\0All Files (*.*)\0*.*\0\0"; + strcpy(name, mass_replace(GetRomName(), "|", ".").c_str()); + ofn.lpstrFile = name; + ofn.lpstrDefExt = "bld"; + ofn.nMaxFile = 256; + ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY; + ofn.hwndOwner = hwnd; + bool success = false; + if (GetSaveFileName(&ofn)) + { + FILE* bld = fopen(name, "wb"); + if (bld) + { + fwrite("BOOKMARKLIST", strlen("BOOKMARKLIST"), 1, bld); + extern int storeHexPreferences(FILE*); + success = storeHexPreferences(bld); + fclose(bld); + } + } + + return success; +} + +int loadBookmarks(HWND hwnd) +{ + char nameo[2048] = { 0 }; + OPENFILENAME ofn; + memset(&ofn, 0, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hInstance = fceu_hInstance; + ofn.lpstrTitle = "Load bookmarks..."; + ofn.lpstrFilter = "Bookmark list (*.bld)\0*.lst\0All Files (*.*)\0*.*\0\0"; + ofn.lpstrFile = nameo; + ofn.nMaxFile = 256; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.hwndOwner = hwnd; + + int success = 0; + if (GetOpenFileName(&ofn)) + { + char buffer[13] = { 0 }; + FILE* bld = fopen(nameo, "r"); + if (bld) + { + fread(bld, strlen("BOOKMARKLIST"), 1, bld); + if (!strcpy(buffer, "BOOKMARKLIST")) + { + extern int loadHexPreferences(FILE*); + success = loadHexPreferences(bld); + } + fclose(bld); + } + } + return success; +} +*/ void FreezeRam(int address, int mode, int final){ // mode: -1 == Unfreeze; 0 == Toggle; 1 == Freeze if(FrozenAddressCount <= 256 && (address < 0x2000) || ((address >= 0x6000) && (address <= 0x7FFF))){ @@ -1198,7 +1261,6 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa HGLOBAL hGlobal ; PTSTR pGlobal ; HMENU hMenu; - MENUITEMINFO MenuInfo; POINT point; PAINTSTRUCT ps ; TEXTMETRIC tm; @@ -1525,11 +1587,11 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa //sprintf(str,"x = %d, y = %d, j = %d",mousex,mousey,j); //MessageBox(hMemView,str, "mouse wheel dance!", MB_OK); hMenu = CreatePopupMenu(); + for(i = 0;i < POPUPNUM;i++) { if((j >= popupmenu[i].minaddress) && (j <= popupmenu[i].maxaddress) && (EditingMode == popupmenu[i].editingmode)) { - memset(&MenuInfo,0,sizeof(MENUITEMINFO)); switch(popupmenu[i].id) { //this will set the text for the menu dynamically based on the id @@ -1608,15 +1670,21 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa break; } } - MenuInfo.cbSize = sizeof(MENUITEMINFO); - MenuInfo.fMask = MIIM_TYPE | MIIM_ID | MIIM_DATA; - MenuInfo.fType = MF_STRING; - MenuInfo.dwTypeData = popupmenu[i].text; - MenuInfo.cch = strlen(popupmenu[i].text); - MenuInfo.wID = popupmenu[i].id; - InsertMenuItem(hMenu,i+1,1,&MenuInfo); + AppendMenu(hMenu, MF_STRING, popupmenu[i].id, popupmenu[i].text); } } + + // Add / Edit / Remove bookmark + int foundBookmark = findBookmark(CursorStartAddy, EditingMode); + if (foundBookmark != -1) + { + AppendMenu(hMenu, MF_STRING, ID_ADDRESS_EDIT_BOOKMARK, "Edit Bookmark"); + AppendMenu(hMenu, MF_STRING, ID_ADDRESS_REMOVE_BOOKMARK, "Remove Bookmark"); + } + else + AppendMenu(hMenu, MF_STRING, ID_ADDRESS_ADD_BOOKMARK, "Add Bookmark"); + + if (i != 0) i = TrackPopupMenuEx(hMenu, TPM_RETURNCMD | TPM_RIGHTBUTTON, x, y, hMemView, NULL); switch(i) @@ -1766,19 +1834,59 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case ID_ADDRESS_CREATE_GG_CODE: SetGGConvFocus(j,GetMem(j)); break; - case ID_ADDRESS_BOOKMARK: + case ID_ADDRESS_ADD_BOOKMARK: { - if (toggleBookmark(hwnd, CursorStartAddy, EditingMode)) + if (foundBookmark == -1) { - MessageBox(hDebug, "Can't set more than 64 bookmarks", "Error", MB_OK | MB_ICONERROR); - } - else - { - updateBookmarkMenus(GetSubMenu(GetMenu(hwnd), BOOKMARKS_SUBMENU_POS)); - UpdateColorTable(); + if (nextBookmark >= 64) + MessageBox(hwnd, "Can't set more than 64 bookmarks.", "Error", MB_OK | MB_ICONERROR); + else + { + int ret = addBookmark(hwnd, CursorStartAddy, EditingMode); + if (ret == -1) + MessageBox(hwnd, "Error adding bookmark.", "Error", MB_OK | MB_ICONERROR); + else if (ret == 0) + { + updateBookmarkMenus(GetSubMenu(GetMenu(hwnd), BOOKMARKS_SUBMENU_POS)); + UpdateColorTable(); + } + } } + else // usually it cannot reach here. + MessageBox(hwnd, "This address already has a bookmark.", "Error", MB_OK | MB_ICONERROR); break; } + case ID_ADDRESS_EDIT_BOOKMARK: + if (foundBookmark != -1) + { + int ret = editBookmark(hwnd, foundBookmark); + if (ret == -1) + MessageBox(hwnd, "Error editing bookmark.", "Error", MB_OK | MB_ICONERROR); + else if (ret == 0) + { + updateBookmarkMenus(GetSubMenu(GetMenu(hwnd), BOOKMARKS_SUBMENU_POS)); + UpdateColorTable(); + } + } + else // usually it cannot reach here. + MessageBox(hwnd, "This address doesn't have a bookmark.", "Error", MB_OK | MB_ICONERROR); + break; + case ID_ADDRESS_REMOVE_BOOKMARK: + if (foundBookmark != -1) + { + int ret = removeBookmark(foundBookmark); + if (ret == -1) + MessageBox(hwnd, "Error removing bookmark.", "Error", MB_OK | MB_ICONERROR); + else if (ret == 0) + { + updateBookmarkMenus(GetSubMenu(GetMenu(hwnd), BOOKMARKS_SUBMENU_POS)); + UpdateColorTable(); + } + } + else + // usually it cannot reach here. + MessageBox(hwnd, "This address doesn't have a bookmark.", "Error", MB_OK | MB_ICONERROR); + break; case ID_ADDRESS_SYMBOLIC_NAME: { if (DoSymbolicDebugNaming(j, hMemView)) @@ -2117,14 +2225,22 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case MENU_MV_BOOKMARKS_RM_ALL: if (nextBookmark) { - if (MessageBox(hwnd, "Remove All Bookmarks?", "Bookmarks", MB_YESNO) == IDYES) + if (MessageBox(hwnd, "Remove All Bookmarks?", "Bookmarks", MB_YESNO | MB_ICONINFORMATION) == IDYES) { removeAllBookmarks(GetSubMenu(GetMenu(hwnd), BOOKMARKS_SUBMENU_POS)); UpdateColorTable(); } } return 0; - +/* + case MENU_MV_BOOKMARKS_EXPORT: + if (!saveBookmarks(hwnd)) + MessageBox(hwnd, "Error saving bookmarks.", "Error", MB_OK | MB_ICONERROR); + return 0; + case MENU_MV_BOOKMARKS_IMPORT: + loadBookmarks(hwnd); + return 0; +*/ case MENU_MV_HELP: OpenHelpWindow(memviewhelp); return 0; @@ -2201,7 +2317,11 @@ void DoMemView() wndclass.lpszMenuName = "MEMVIEWMENU"; wndclass.lpszClassName = "MEMVIEW"; - if(!RegisterClassEx(&wndclass)) {FCEUD_PrintError("Error Registering MEMVIEW Window Class."); return;} + if(!RegisterClassEx(&wndclass)) + { + FCEUD_PrintError("Error Registering MEMVIEW Window Class."); + return; + } hMemView = CreateWindowEx(0,"MEMVIEW","Memory Editor", //WS_OVERLAPPEDWINDOW|WS_CLIPSIBLINGS, /* Style */ diff --git a/src/drivers/win/memview.h b/src/drivers/win/memview.h index 928e5593..7dc9a882 100644 --- a/src/drivers/win/memview.h +++ b/src/drivers/win/memview.h @@ -4,7 +4,10 @@ void UpdateMemoryView(int draw_all); void UpdateColorTable(); void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset); void UpdateCaption(); - +/* +int saveBookmarks(HWND hwnd); +int loadBookmarks(HWND hwnd); +*/ void ApplyPatch(int addr,int size, uint8* data); void UndoLastPatch(); @@ -13,5 +16,4 @@ void SetHexEditorAddress(int gotoaddress); extern HWND hMemView, hMemFind; extern int EditingMode; -extern char EditString[4][20]; - +extern char EditString[4][20]; \ No newline at end of file diff --git a/src/drivers/win/memviewsp.cpp b/src/drivers/win/memviewsp.cpp index d65e2ace..a36de47e 100644 --- a/src/drivers/win/memviewsp.cpp +++ b/src/drivers/win/memviewsp.cpp @@ -52,13 +52,13 @@ int findBookmark(unsigned int address, int editmode) return -1; } -char bookmarkDescription[51] = {0}; - BOOL CenterWindow(HWND hwndDlg); /// Callback function for the name bookmark dialog INT_PTR CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { + static char* description; + switch (uMsg) { case WM_INITDIALOG: @@ -67,7 +67,9 @@ INT_PTR CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA // Put the current bookmark description into the edit field // and set focus to that edit field. - SetDlgItemText(hwndDlg, IDC_BOOKMARK_DESCRIPTION, bookmarkDescription); + + description = (char*)lParam; + SetDlgItemText(hwndDlg, IDC_BOOKMARK_DESCRIPTION, description); SetFocus(GetDlgItem(hwndDlg, IDC_BOOKMARK_DESCRIPTION)); break; case WM_CLOSE: @@ -83,7 +85,7 @@ INT_PTR CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA case IDOK: { // Update the bookmark description - GetDlgItemText(hwndDlg, IDC_BOOKMARK_DESCRIPTION, bookmarkDescription, 50); + GetDlgItemText(hwndDlg, IDC_BOOKMARK_DESCRIPTION, description, 50); EndDialog(hwndDlg, 1); break; } @@ -99,38 +101,63 @@ INT_PTR CALLBACK nameBookmarkCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA /// @param hwnd HWND of the FCEU window /// @param address Address of the new bookmark /// @param editmode The editing mode of the hex editor (RAM/PPU/OAM/ROM) -/// @return Returns 0 if everything's OK and an error flag otherwise. +/// @return Returns 0 if everything's OK, 1 if user canceled and an error flag otherwise. int addBookmark(HWND hwnd, unsigned int address, int editmode) { // Enforce a maximum of 64 bookmarks if (nextBookmark < 64) { - sprintf(bookmarkDescription, "%s %04X", EditString[editmode], address); + char description[51] = { 0 }; + sprintf(description, "%s %04X", EditString[editmode], address); // Show the bookmark name dialog - DialogBox(fceu_hInstance, "NAMEBOOKMARKDLG", hwnd, nameBookmarkCallB); - - // Update the bookmark description - hexBookmarks[nextBookmark].address = address; - hexBookmarks[nextBookmark].editmode = editmode; - strcpy(hexBookmarks[nextBookmark].description, bookmarkDescription); - - nextBookmark++; - + if (DialogBoxParam(fceu_hInstance, "NAMEBOOKMARKDLG", hwnd, nameBookmarkCallB, (LPARAM)description)) + { + // Add the bookmark + hexBookmarks[nextBookmark].address = address; + hexBookmarks[nextBookmark].editmode = editmode; + strcpy(hexBookmarks[nextBookmark].description, description); + nextBookmark++; + return 0; + } + else + return 1; + } + else + return -1; +} + +/// Edit a bookmark in the bookmark list +/// @param hwnd HWND of the FCEU window +/// @param index Index of the bookmark to edit +/// @return Returns 0 if everything's OK, 1 if user canceled and an error flag otherwise. +int editBookmark(HWND hwnd, unsigned int index) +{ + if (index >= 64) return -1; + + char description[51] = { 0 }; + strcpy(description, hexBookmarks[index].description); + + // Show the bookmark name dialog + if (DialogBoxParam(fceu_hInstance, "NAMEBOOKMARKDLG", hwnd, nameBookmarkCallB, (LPARAM)description)) + { + // Update the bookmark information + strcpy(hexBookmarks[index].description, description); return 0; } else - { return 1; - } + + return -1; } /// Removes a bookmark from the bookmark list /// @param index Index of the bookmark to remove -void removeBookmark(unsigned int index) +/// @return Returns 0 if everything's OK, 1 if user canceled and an error flag otherwise. +int removeBookmark(unsigned int index) { - // TODO: Range checking - + if (index >= 64) return -1; + // At this point it's necessary to move the content of the bookmark list for (int i=index;iType != 'S') { diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 055f8398..1c2fd941 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ 生成的包含文件。 -// 供 res.rc 使用 +// Microsoft Visual C++ generated include file. +// Used for res.rc // #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 diff --git a/src/fceulua.h b/src/fceulua.h index 4a0933d2..08b8a879 100644 --- a/src/fceulua.h +++ b/src/fceulua.h @@ -72,6 +72,7 @@ void FCEU_ReloadLuaCode(); void FCEU_LuaStop(); int FCEU_LuaRunning(); +void FCEU_LuaReadZapper(const uint32* mouse_in, uint32* mouse_out); uint8 FCEU_LuaReadJoypad(int,uint8); // HACK - Function needs controller input int FCEU_LuaSpeed(); int FCEU_LuaFrameskip(); diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 1a5a7020..76f99cb3 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -208,6 +208,11 @@ static int wasPaused = FALSE; // Transparency strength. 255=opaque, 0=so transparent it's invisible static int transparencyModifier = 255; +// Our zapper. +static int luazapperx = -1; +static int luazappery = -1; +static int luazapperfire = -1; + // Our joypads. static uint8 luajoypads1[4]= { 0xFF, 0xFF, 0xFF, 0xFF }; //x1 static uint8 luajoypads2[4]= { 0x00, 0x00, 0x00, 0x00 }; //0x @@ -278,6 +283,9 @@ static const char* toCString(lua_State* L, int idx=0); static void FCEU_LuaOnStop() { luaRunning = FALSE; + luazapperx = -1; + luazappery = -1; + luazapperfire = -1; for (int i = 0 ; i < 4 ; i++ ){ luajoypads1[i]= 0xFF; // Set these back to pass-through luajoypads2[i]= 0x00; @@ -2536,7 +2544,37 @@ static int zapper_read(lua_State *L){ return 1; } +// zapper.set(table state) +// +// Sets the zapper state for the next frame advance. +static int zapper_set(lua_State* L) { + luaL_checktype(L, 1, LUA_TTABLE); + + luazapperx = -1; + luazappery = -1; + luazapperfire = -1; + + lua_getfield(L, 1, "x"); + if (!lua_isnil(L, -1)) luazapperx = lua_tointeger(L, -1); + lua_pop(L, 1); + + lua_getfield(L, 1, "y"); + if (!lua_isnil(L, -1)) luazappery = lua_tointeger(L, -1); + lua_pop(L, 1); + + lua_getfield(L, 1, "fire"); + if (!lua_isnil(L, -1)) + { + if (lua_toboolean(L, -1)) // True or string + luazapperfire = 1; + if (lua_toboolean(L, -1) == 0 || lua_isstring(L, -1)) // False or string + luazapperfire = 0; + } + lua_pop(L, 1); + + return 0; +} // table joypad.read(int which = 1) // @@ -5815,6 +5853,7 @@ static const struct luaL_reg joypadlib[] = { static const struct luaL_reg zapperlib[] = { {"read", zapper_read}, + {"set", zapper_set}, {NULL,NULL} }; @@ -6309,6 +6348,15 @@ int FCEU_LuaRunning() { return (int) (L != NULL); // should return true if callback functions are active. } +/** + * Applies zapper.set overrides to zapper input. + */ +void FCEU_LuaReadZapper(const uint32* mouse_in, uint32* mouse_out) +{ + mouse_out[0] = luazapperx >= 0 ? luazapperx : mouse_in[0]; + mouse_out[1] = luazappery >= 0 ? luazappery : mouse_in[1]; + mouse_out[2] = luazapperfire >= 0 ? (luazapperfire | (mouse_in[2] & ~1)) : mouse_in[2]; +} /** * Returns true if Lua would like to steal the given joypad control. diff --git a/web/download.html b/web/download.html index 49fc5c71..ce46695b 100644 --- a/web/download.html +++ b/web/download.html @@ -79,14 +79,14 @@
  • FCEUX 2.2.3 src
  • -

    If you are working with a developer to fix an issue affecting you then this is where you will find your fixed build. It may potentially be out of date.

    - +

    If you are working with a developer to fix an issue affecting you then this is where you will find your fixed build:

    +

    Source Code

    -

    FCEUX development is done commited to a subversion repository hosted at sourceforge. The last version of the source can be found there.

    +

    FCEUX development is done commited to a Git repository hosted at Github. The last version of the source can be found there.

    Compiling