This commit is contained in:
commit
88e0c838e2
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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];
|
|
@ -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;i<nextBookmark - 1;i++)
|
||||
{
|
||||
|
@ -138,8 +165,10 @@ void removeBookmark(unsigned int index)
|
|||
}
|
||||
|
||||
--nextBookmark;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
/// Adds or removes a bookmark from a given address
|
||||
/// @param hwnd HWND of the emu window
|
||||
/// @param address Address of the bookmark
|
||||
|
@ -159,35 +188,28 @@ int toggleBookmark(HWND hwnd, uint32 address, int editmode)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/// Updates the bookmark menu in the hex window
|
||||
/// @param menu Handle of the bookmark menu
|
||||
void updateBookmarkMenus(HMENU menu)
|
||||
{
|
||||
int i;
|
||||
MENUITEMINFO mi;
|
||||
mi.cbSize = sizeof(MENUITEMINFO);
|
||||
mi.fMask = MIIM_TYPE | MIIM_ID | MIIM_DATA;
|
||||
mi.fType = MF_STRING;
|
||||
|
||||
// Remove all bookmark menus
|
||||
for (i = 0;i<nextBookmark + 1;i++)
|
||||
{
|
||||
for (int i = 0; i<nextBookmark + 1; i++)
|
||||
RemoveMenu(menu, ID_FIRST_BOOKMARK + i, MF_BYCOMMAND);
|
||||
}
|
||||
|
||||
// Add the menus again
|
||||
for (i = 0;i<nextBookmark;i++)
|
||||
RemoveMenu(menu, ID_BOOKMARKLIST_SEP, MF_BYCOMMAND);
|
||||
|
||||
if (nextBookmark != 0)
|
||||
{
|
||||
// Get the text of the menu
|
||||
char buffer[0x100];
|
||||
sprintf(buffer, i < 10 ? "&%d. $%04X - %s\tCtrl+%d" : "%d. $%04X - %s",i, hexBookmarks[i].address, hexBookmarks[i].description, i);
|
||||
// Add the menus again
|
||||
AppendMenu(menu, MF_SEPARATOR, ID_BOOKMARKLIST_SEP, NULL);
|
||||
for (int i = 0;i<nextBookmark;i++)
|
||||
{
|
||||
// Get the text of the menu
|
||||
char buffer[0x100];
|
||||
sprintf(buffer, i < 10 ? "&%d. $%04X - %s\tCtrl+%d" : "%d. $%04X - %s",i, hexBookmarks[i].address, hexBookmarks[i].description, i);
|
||||
|
||||
mi.dwTypeData = buffer;
|
||||
mi.cch = strlen(buffer);
|
||||
mi.wID = ID_FIRST_BOOKMARK + i;
|
||||
|
||||
InsertMenuItem(menu, 2 + i , TRUE, &mi);
|
||||
AppendMenu(menu, MF_STRING, ID_FIRST_BOOKMARK + i, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +234,7 @@ void removeAllBookmarks(HMENU menu)
|
|||
{
|
||||
RemoveMenu(menu, ID_FIRST_BOOKMARK + i, MF_BYCOMMAND);
|
||||
}
|
||||
RemoveMenu(menu, ID_BOOKMARKLIST_SEP, MF_BYCOMMAND);
|
||||
|
||||
nextBookmark = 0;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
#include "types.h"
|
||||
|
||||
#define ID_FIRST_BOOKMARK 30
|
||||
#define ID_BOOKMARKLIST_SEP (ID_FIRST_BOOKMARK - 1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -32,8 +33,11 @@ typedef struct
|
|||
extern HexBookmark hexBookmarks[64];
|
||||
extern int nextBookmark;
|
||||
|
||||
int toggleBookmark(HWND hwnd, uint32 address, int mode);
|
||||
int findBookmark(unsigned int address, int editmode);
|
||||
int addBookmark(HWND hwnd, unsigned int address, int editmode);
|
||||
int editBookmark(HWND hwnd, unsigned int index);
|
||||
int removeBookmark(unsigned int index);
|
||||
// int toggleBookmark(HWND hwnd, uint32 address, int mode);
|
||||
void updateBookmarkMenus(HMENU menu);
|
||||
int handleBookmarkMenu(int bookmark);
|
||||
void removeAllBookmarks(HMENU menu);
|
||||
|
||||
|
|
|
@ -797,19 +797,21 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
addrCtrlID = IDC_EDIT_COMPAREADDRESS;
|
||||
// limit the length to 4 since currently doesn't support batch editing
|
||||
SendDlgItemMessage(hDlg, addrCtrlID, EM_SETLIMITTEXT, 4, 0);
|
||||
strcpy(title, "Edit ");
|
||||
strcpy(title, "Edit");
|
||||
break;
|
||||
case WATCHER_MSG_ADD:
|
||||
strcpy(title, "Add ");
|
||||
strcpy(title, "Add");
|
||||
addrCtrlID = IDC_EDIT_COMPAREADDRESSES;
|
||||
break;
|
||||
case WATCHER_MSG_DUP:
|
||||
default:
|
||||
strcpy(title, "Duplicate ");
|
||||
strcpy(title, "Duplicate");
|
||||
addrCtrlID = IDC_EDIT_COMPAREADDRESSES;
|
||||
break;
|
||||
}
|
||||
|
||||
strcat(title, " ");
|
||||
|
||||
// The information is needed to fill to the UI, and separetor doesn't have them
|
||||
if (msg->Type != 'S')
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -79,14 +79,14 @@
|
|||
<li><a href="http://sourceforge.net/projects/fceultra/files/Source%20Code/2.2.3%20src/fceux-2.2.3.src.tar.gz/download">FCEUX 2.2.3 src</a></li>
|
||||
</ul>
|
||||
|
||||
<p>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.</p>
|
||||
<ul><li><a href="http://fceux.com/zip">Interim Build $WCREV$</a> $WCDATE$</li></ul>
|
||||
<p>If you are working with a developer to fix an issue affecting you then this is where you will find your fixed build:</p>
|
||||
<ul><li><a href="https://ci.appveyor.com/project/zeromus/fceux/build/artifacts">Interim Build</a></li></ul>
|
||||
|
||||
<h3>Source Code</h3>
|
||||
<ul>
|
||||
<li><a href="http://sourceforge.net/p/fceultra/code/">SVN repository</a></li>
|
||||
<li><a href="https://github.com/TASVideos/fceux">Git repository</a></li>
|
||||
</ul>
|
||||
<p>FCEUX development is done commited to a subversion repository hosted at sourceforge. The last version of the source can be found there.</p>
|
||||
<p>FCEUX development is done commited to a Git repository hosted at Github. The last version of the source can be found there.</p>
|
||||
<h4>Compiling</h4>
|
||||
<ul>
|
||||
<li>Win32 uses MS Visual Studio 2010. Newer versions of visual studio should be able to build it, with a little trouble.</li>
|
||||
|
|
|
@ -418,8 +418,17 @@
|
|||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts37">The return table consists of 3 values: x, y, and fire. x and y are the x,y coordinates of the zapper target in terms of pixels. fire represents the zapper firing. 0 = not firing, 1 = firing</span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts64">zapper.set(table input)</span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts37">Note: The zapper is always controller 2 on the NES so there is no player argument to this function.</span></p>
|
||||
<p><span class="rvts37">Sets the zapper input state.</span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts37">Taple entries (nil or -1 to leave unaffected):</span></p>
|
||||
<p><span class="rvts37">x - Forces the X position </span></p>
|
||||
<p><span class="rvts37">y - Forces the Y position</span></p>
|
||||
<p><span class="rvts37">fire - Forces trigger (true/1 on, false/0 off)</span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts37">Note: The zapper is always controller 2 on the NES so there is no player argument to these functions.</span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts37"><br/></span></p>
|
||||
<p><span class="rvts71">Input Library</span></p>
|
||||
|
|
Loading…
Reference in New Issue