Cleaned up some code.
This commit is contained in:
parent
652c36be53
commit
1644cb0762
|
@ -2408,7 +2408,6 @@ int pause = 0;
|
||||||
**/
|
**/
|
||||||
static BOOL CALLBACK BasicBotCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static BOOL CALLBACK BasicBotCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
DSMFix(uMsg); // stops sound on 5 of the messages...
|
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
|
|
@ -26,7 +26,6 @@ extern HWND hAppWnd;
|
||||||
extern HINSTANCE fceu_hInstance;
|
extern HINSTANCE fceu_hInstance;
|
||||||
|
|
||||||
extern int NoWaiting;
|
extern int NoWaiting;
|
||||||
void DSMFix(UINT msg);
|
|
||||||
|
|
||||||
extern int eoptions;
|
extern int eoptions;
|
||||||
|
|
||||||
|
|
|
@ -42,16 +42,16 @@ static CFGSTRUCT fceuconfig[] = {
|
||||||
ACS(recent_files[8]),
|
ACS(recent_files[8]),
|
||||||
ACS(recent_files[9]),
|
ACS(recent_files[9]),
|
||||||
|
|
||||||
ACS(rdirs[0]),
|
ACS(recent_directories[0]),
|
||||||
ACS(rdirs[1]),
|
ACS(recent_directories[1]),
|
||||||
ACS(rdirs[2]),
|
ACS(recent_directories[2]),
|
||||||
ACS(rdirs[3]),
|
ACS(recent_directories[3]),
|
||||||
ACS(rdirs[4]),
|
ACS(recent_directories[4]),
|
||||||
ACS(rdirs[5]),
|
ACS(recent_directories[5]),
|
||||||
ACS(rdirs[6]),
|
ACS(recent_directories[6]),
|
||||||
ACS(rdirs[7]),
|
ACS(recent_directories[7]),
|
||||||
ACS(rdirs[8]),
|
ACS(recent_directories[8]),
|
||||||
ACS(rdirs[9]),
|
ACS(recent_directories[9]),
|
||||||
|
|
||||||
AC(ntsccol),AC(ntsctint),AC(ntschue),
|
AC(ntsccol),AC(ntsctint),AC(ntschue),
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,6 @@ void RedoText(void)
|
||||||
**/
|
**/
|
||||||
BOOL CALLBACK LogCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK LogCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
DSMFix(uMsg);
|
|
||||||
|
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
|
|
@ -64,7 +64,7 @@ void ResetVideo(void);
|
||||||
void ShowCursorAbs(int w);
|
void ShowCursorAbs(int w);
|
||||||
void HideFWindow(int h);
|
void HideFWindow(int h);
|
||||||
void FixWXY(int pref);
|
void FixWXY(int pref);
|
||||||
int SetMainWindowStuff(void);
|
void SetMainWindowStuff(void);
|
||||||
int GetClientAbsRect(LPRECT lpRect);
|
int GetClientAbsRect(LPRECT lpRect);
|
||||||
void UpdateFCEUWindow(void);
|
void UpdateFCEUWindow(void);
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -185,13 +185,44 @@
|
||||||
#define MENU_MSGLOG 40047
|
#define MENU_MSGLOG 40047
|
||||||
#define MENU_CHEATS 40048
|
#define MENU_CHEATS 40048
|
||||||
#define MENU_BASIC_BOT 40049
|
#define MENU_BASIC_BOT 40049
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_1 40050
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_2 40051
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_3 40052
|
||||||
#define ID_DEBUG_DEBUGGER 40053
|
#define ID_DEBUG_DEBUGGER 40053
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_4 40053
|
||||||
#define ID_DEBUG_PPUVIEWER 40054
|
#define ID_DEBUG_PPUVIEWER 40054
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_5 40054
|
||||||
#define ID_DEBUG_NAMETABLEVIEWER 40055
|
#define ID_DEBUG_NAMETABLEVIEWER 40055
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_6 40055
|
||||||
#define ID_DEBUG_HEXEDITOR 40056
|
#define ID_DEBUG_HEXEDITOR 40056
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_7 40056
|
||||||
#define ID_DEBUG_TRACELOGGER 40057
|
#define ID_DEBUG_TRACELOGGER 40057
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_8 40057
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_9 40058
|
||||||
#define ID_DEBUG_GAMEGENIEDECODER 40059
|
#define ID_DEBUG_GAMEGENIEDECODER 40059
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_10 40059
|
||||||
#define ID_DEBUG_CDLOGGER 40060
|
#define ID_DEBUG_CDLOGGER 40060
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_11 40060
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_12 40061
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_13 40062
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_14 40063
|
||||||
|
#define MENU_AUTOFIRE_PATTERN_15 40064
|
||||||
|
#define MENU_AUTOFIRE_OFFSET_1 40065
|
||||||
|
#define MENU_AUTOFIRE_OFFSET_2 40066
|
||||||
|
#define MENU_AUTOFIRE_OFFSET_3 40067
|
||||||
|
#define MENU_AUTOFIRE_OFFSET_4 40068
|
||||||
|
#define MENU_AUTOFIRE_OFFSET_5 40069
|
||||||
|
#define MENU_AUTOFIRE_OFFSET_6 40070
|
||||||
|
#define MENU_ALTERNATE_AB 40071
|
||||||
|
#define MENU_EXTERNAL_INPUT 40072
|
||||||
|
#define MENU_DEBUG 40073
|
||||||
|
#define MENU_PPUVIEWER 40074
|
||||||
|
#define MENU_NAMETABLEVIEWER 40075
|
||||||
|
#define MENU_HEXEDITOR 40076
|
||||||
|
#define MENU_TRACELOGGER 40077
|
||||||
|
#define MENU_CDLOGGER 40078
|
||||||
|
#define MENU_GAMEGENIEDECODER 40079
|
||||||
|
#define MENU_DEBUGGER 40080
|
||||||
#define MENU_LOG_SOUND 40120
|
#define MENU_LOG_SOUND 40120
|
||||||
#define GUI_BOT_DEBUG 65436
|
#define GUI_BOT_DEBUG 65436
|
||||||
#define GUI_BOT_ERROR 65438
|
#define GUI_BOT_ERROR 65438
|
||||||
|
@ -202,7 +233,7 @@
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40050
|
#define _APS_NEXT_COMMAND_VALUE 40081
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1117
|
#define _APS_NEXT_CONTROL_VALUE 1117
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,32 +20,58 @@
|
||||||
|
|
||||||
#include "state.cpp" /* Save/Load state AS */
|
#include "state.cpp" /* Save/Load state AS */
|
||||||
|
|
||||||
extern char *md5_asciistr(uint8 digest[16]);
|
// #defines
|
||||||
|
|
||||||
|
#define MAX(x,y) ((x)<(y)?(y):(x))
|
||||||
|
#define MIN(x,y) ((x)>(y)?(y):(x))
|
||||||
|
|
||||||
|
// Type definitions
|
||||||
|
|
||||||
|
struct CreateMovieParameters
|
||||||
|
{
|
||||||
|
char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose.
|
||||||
|
int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename
|
||||||
|
char* szSavestateFilename;
|
||||||
|
WCHAR metadata[MOVIE_MAX_METADATA];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extern variables
|
||||||
|
|
||||||
extern FCEUGI *GameInfo;
|
extern FCEUGI *GameInfo;
|
||||||
extern int EnableRewind;
|
extern int EnableRewind;
|
||||||
|
extern int movieConvertOffset1, movieConvertOffset2, movieConvertOK;
|
||||||
|
|
||||||
|
// Extern functions
|
||||||
|
|
||||||
|
char *md5_asciistr(uint8 digest[16]);
|
||||||
|
|
||||||
|
void ConfigGUI();
|
||||||
|
void ConfigTiming();
|
||||||
|
void ConfigPalette();
|
||||||
|
void ConfigDirectories();
|
||||||
|
|
||||||
|
void RestartMovieOrReset(unsigned int pow);
|
||||||
|
int KeyboardSetBackgroundAccess(int on); //mbg merge 7/17/06 YECH had to add
|
||||||
|
void SetJoystickBackgroundAccess(int background); //mbg merge 7/17/06 YECH had to add
|
||||||
|
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
|
||||||
|
int FCEUMOV_IsPlaying(void); //mbg merge 7/17/06 YECH had to add
|
||||||
|
void DoPPUView();//mbg merge 7/19/06 yech had to add
|
||||||
|
|
||||||
|
void MapInput(void);
|
||||||
|
|
||||||
|
// Internal variables
|
||||||
|
|
||||||
// Contains recent file strings
|
// Contains recent file strings
|
||||||
char *recent_files[] = { 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
|
char *recent_files[] = { 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
|
||||||
char *rdirs[10]={0,0,0,0,0,0,0,0,0,0};
|
char *recent_directories[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
const unsigned int MENU_FIRST_RECENT_FILE = 600;
|
const unsigned int MENU_FIRST_RECENT_FILE = 600;
|
||||||
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
|
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
|
||||||
|
const unsigned int MAX_NUMBER_OF_RECENT_DIRS = sizeof(recent_directories)/sizeof(*recent_directories);
|
||||||
|
|
||||||
void DSMFix(UINT msg)
|
static int movieHackType = 3;
|
||||||
{
|
|
||||||
switch(msg)
|
static HWND pwindow;
|
||||||
{
|
|
||||||
case WM_VSCROLL:
|
|
||||||
case WM_NCRBUTTONDOWN:
|
|
||||||
case WM_NCMBUTTONDOWN:
|
|
||||||
case WM_NCLBUTTONDOWN:
|
|
||||||
case WM_ENTERMENULOOP:break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void ConfigGUI(void);
|
|
||||||
static void ConfigTiming(void);
|
|
||||||
static void ConfigPalette(void);
|
|
||||||
static void ConfigDirectories(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu handle of the main menu.
|
* Menu handle of the main menu.
|
||||||
|
@ -53,15 +79,33 @@ static void ConfigDirectories(void);
|
||||||
static HMENU fceumenu = 0;
|
static HMENU fceumenu = 0;
|
||||||
|
|
||||||
static int tog = 0;
|
static int tog = 0;
|
||||||
static int CheckedAutoFirePattern=40004;
|
static int CheckedAutoFirePattern = MENU_AUTOFIRE_PATTERN_1;
|
||||||
static int CheckedAutoFireOffset=40016;
|
static int CheckedAutoFireOffset = MENU_AUTOFIRE_OFFSET_1;
|
||||||
static int EnableBackgroundInput = 0;
|
static int EnableBackgroundInput = 0;
|
||||||
|
|
||||||
void ShowCursorAbs(int w)
|
static HMENU recentmenu, recentdmenu;
|
||||||
|
|
||||||
|
static LONG WindowXC=1<<30,WindowYC;
|
||||||
|
|
||||||
|
static uint32 mousex,mousey,mouseb;
|
||||||
|
|
||||||
|
static int vchanged = 0;
|
||||||
|
|
||||||
|
static int ReplayDialogReadOnlyStatus = 0;
|
||||||
|
static int ReplayDialogStopFrame = 0;
|
||||||
|
|
||||||
|
// Internal functions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the state of the mouse cursor.
|
||||||
|
*
|
||||||
|
* @param set_visible Determines the visibility of the cursor ( 1 or 0 )
|
||||||
|
**/
|
||||||
|
void ShowCursorAbs(int set_visible)
|
||||||
{
|
{
|
||||||
static int stat = 0;
|
static int stat = 0;
|
||||||
|
|
||||||
if(w)
|
if(set_visible)
|
||||||
{
|
{
|
||||||
if(stat == -1)
|
if(stat == -1)
|
||||||
{
|
{
|
||||||
|
@ -99,50 +143,52 @@ void CalcWindowSize(RECT *al)
|
||||||
al->top=0;
|
al->top=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RedoMenuGI(FCEUGI *gi)
|
/**
|
||||||
|
* Updates the menu items that should only be enabled if a game is loaded.
|
||||||
|
*
|
||||||
|
* @param enable Flag that indicates whether the menus should be enabled (1) or disabled (0).
|
||||||
|
**/
|
||||||
|
void updateGameDependentMenus(unsigned int enable)
|
||||||
{
|
{
|
||||||
int simpled[]= { 101,
|
const int menu_ids[]= {
|
||||||
111,
|
MENU_CLOSE_FILE,
|
||||||
110,
|
MENU_SAVE_STATE,
|
||||||
|
MENU_LOAD_STATE,
|
||||||
MENU_RESET,
|
MENU_RESET,
|
||||||
MENU_POWER,
|
MENU_POWER,
|
||||||
204,
|
MENU_INSERT_COIN,
|
||||||
203,
|
MENU_SWITCH_DISK,
|
||||||
141,
|
MENU_RECORD_MOVIE,
|
||||||
142,
|
MENU_REPLAY_MOVIE,
|
||||||
143,
|
MENU_STOP_MOVIE,
|
||||||
151,
|
MENU_RECORD_AVI,
|
||||||
152,
|
MENU_STOP_AVI,
|
||||||
40120,
|
MENU_LOG_SOUND,
|
||||||
MENU_HIDE_MENU,
|
MENU_HIDE_MENU,
|
||||||
40003,
|
40003
|
||||||
40028,
|
};
|
||||||
0};
|
|
||||||
|
|
||||||
int x;
|
for (unsigned int i = 0; i < sizeof(menu_ids) / sizeof(*menu_ids); i++)
|
||||||
|
|
||||||
x = 0;
|
|
||||||
while(simpled[x])
|
|
||||||
{
|
{
|
||||||
#ifndef FCEUDEF_DEBUGGER
|
#ifndef FCEUDEF_DEBUGGER
|
||||||
if(simpled[x] == 203)
|
if(simpled[i] == 203)
|
||||||
EnableMenuItem(fceumenu,simpled[x],MF_BYCOMMAND | MF_GRAYED);
|
EnableMenuItem(fceumenu,menu_ids[i],MF_BYCOMMAND | MF_GRAYED);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifndef _USE_SHARED_MEMORY_
|
#ifndef _USE_SHARED_MEMORY_
|
||||||
if(simpled[x] == MENU_BASIC_BOT || simpled[x] == 40003)
|
if(simpled[x] == MENU_BASIC_BOT || simpled[i] == 40003)
|
||||||
EnableMenuItem(fceumenu,simpled[x],MF_BYCOMMAND| MF_GRAYED);
|
EnableMenuItem(fceumenu,menu_ids[i],MF_BYCOMMAND| MF_GRAYED);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
EnableMenuItem(fceumenu,simpled[x],MF_BYCOMMAND | (gi?MF_ENABLED:MF_GRAYED));
|
EnableMenuItem(fceumenu, menu_ids[i], MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED));
|
||||||
x++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates menu items which need to be checked or unchecked.
|
* Updates menu items which need to be checked or unchecked.
|
||||||
**/
|
**/
|
||||||
void UpdateCheckedMenuItems(void)
|
void UpdateCheckedMenuItems()
|
||||||
{
|
{
|
||||||
static int *polo[] = { &genie, &pal_emulation, &status_icon };
|
static int *polo[] = { &genie, &pal_emulation, &status_icon };
|
||||||
static int polo2[]={ MENU_GAME_GENIE, MENU_PAL, MENU_SHOW_STATUS_ICON };
|
static int polo2[]={ MENU_GAME_GENIE, MENU_PAL, MENU_SHOW_STATUS_ICON };
|
||||||
|
@ -164,30 +210,30 @@ void UpdateCheckedMenuItems(void)
|
||||||
CheckMenuItem(fceumenu, MENU_ENABLE_REWIND, EnableRewind ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(fceumenu, MENU_ENABLE_REWIND, EnableRewind ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
|
||||||
int AutoFirePatternIDs[] = {
|
int AutoFirePatternIDs[] = {
|
||||||
40004,
|
MENU_AUTOFIRE_PATTERN_1,
|
||||||
40005,
|
MENU_AUTOFIRE_PATTERN_2,
|
||||||
40006,
|
MENU_AUTOFIRE_PATTERN_3,
|
||||||
40007,
|
MENU_AUTOFIRE_PATTERN_4,
|
||||||
40008,
|
MENU_AUTOFIRE_PATTERN_5,
|
||||||
40009,
|
MENU_AUTOFIRE_PATTERN_6,
|
||||||
40010,
|
MENU_AUTOFIRE_PATTERN_7,
|
||||||
40011,
|
MENU_AUTOFIRE_PATTERN_8,
|
||||||
40012,
|
MENU_AUTOFIRE_PATTERN_9,
|
||||||
40013,
|
MENU_AUTOFIRE_PATTERN_10,
|
||||||
40014,
|
MENU_AUTOFIRE_PATTERN_11,
|
||||||
40015,
|
MENU_AUTOFIRE_PATTERN_12,
|
||||||
40022,
|
MENU_AUTOFIRE_PATTERN_13,
|
||||||
40023,
|
MENU_AUTOFIRE_PATTERN_14,
|
||||||
40024,
|
MENU_AUTOFIRE_PATTERN_15,
|
||||||
0};
|
0};
|
||||||
|
|
||||||
int AutoFireOffsetIDs[] = {
|
int AutoFireOffsetIDs[] = {
|
||||||
40016,
|
MENU_AUTOFIRE_OFFSET_1,
|
||||||
40017,
|
MENU_AUTOFIRE_OFFSET_2,
|
||||||
40018,
|
MENU_AUTOFIRE_OFFSET_3,
|
||||||
40019,
|
MENU_AUTOFIRE_OFFSET_4,
|
||||||
40020,
|
MENU_AUTOFIRE_OFFSET_5,
|
||||||
40021,
|
MENU_AUTOFIRE_OFFSET_6,
|
||||||
0};
|
0};
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -209,8 +255,6 @@ void UpdateCheckedMenuItems(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static HMENU recentmenu, recentdmenu;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates recent files / recent directories menu
|
* Updates recent files / recent directories menu
|
||||||
*
|
*
|
||||||
|
@ -277,20 +321,23 @@ void UpdateRMenu(HMENU menu, char **strs, unsigned int mitem, unsigned int basei
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a filename to the recent files list.
|
* Helper function to populate the recent directories and recent files arrays.
|
||||||
*
|
*
|
||||||
* @param filename Name of the file to add.
|
* @param addString String to add to the array.
|
||||||
|
* @param bufferArray Array where the string will be added.
|
||||||
|
* @param arrayLen Length of the bufferArray.
|
||||||
|
* @param menu Menu handle of the main menu.
|
||||||
|
* @param menuItem
|
||||||
|
* @param baseID
|
||||||
**/
|
**/
|
||||||
void AddRecent(const char *filename)
|
void UpdateRecentArray(const char* addString, char** bufferArray, unsigned int arrayLen, HMENU menu, unsigned int menuItem, unsigned int baseId)
|
||||||
{
|
{
|
||||||
int x;
|
|
||||||
|
|
||||||
// Try to find out if the filename is already in the recent files list.
|
// Try to find out if the filename is already in the recent files list.
|
||||||
for( x = 0; x < MAX_NUMBER_OF_RECENT_FILES; x++)
|
for(unsigned int x = 0; x < arrayLen; x++)
|
||||||
{
|
{
|
||||||
if(recent_files[x])
|
if(bufferArray[x])
|
||||||
{
|
{
|
||||||
if(!strcmp(recent_files[x], filename)) // Item is already in list.
|
if(!strcmp(bufferArray[x], addString)) // Item is already in list.
|
||||||
{
|
{
|
||||||
// If the filename is in the file list don't add it again.
|
// If the filename is in the file list don't add it again.
|
||||||
// Move it up in the list instead.
|
// Move it up in the list instead.
|
||||||
|
@ -299,19 +346,19 @@ void AddRecent(const char *filename)
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
// Save pointer.
|
// Save pointer.
|
||||||
tmp = recent_files[x];
|
tmp = bufferArray[x];
|
||||||
|
|
||||||
for(y = x; y; y--)
|
for(y = x; y; y--)
|
||||||
{
|
{
|
||||||
// Move items down.
|
// Move items down.
|
||||||
recent_files[y] = recent_files[y - 1];
|
bufferArray[y] = bufferArray[y - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put item on top.
|
// Put item on top.
|
||||||
recent_files[0] = tmp;
|
bufferArray[0] = tmp;
|
||||||
|
|
||||||
// Update the recent files menu
|
// Update the recent files menu
|
||||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
UpdateRMenu(menu, bufferArray, menuItem, baseId);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -322,50 +369,43 @@ void AddRecent(const char *filename)
|
||||||
|
|
||||||
// If there's no space left in the recent files list, get rid of the last
|
// If there's no space left in the recent files list, get rid of the last
|
||||||
// item in the list.
|
// item in the list.
|
||||||
if(recent_files[MAX_NUMBER_OF_RECENT_FILES - 1])
|
if(bufferArray[arrayLen - 1])
|
||||||
{
|
{
|
||||||
free(recent_files[MAX_NUMBER_OF_RECENT_FILES - 1]);
|
free(bufferArray[arrayLen - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the other items down.
|
// Move the other items down.
|
||||||
for(x = MAX_NUMBER_OF_RECENT_FILES - 1; x; x--)
|
for(x = arrayLen - 1; x; x--)
|
||||||
{
|
{
|
||||||
recent_files[x] = recent_files[x - 1];
|
bufferArray[x] = bufferArray[x - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new item.
|
// Add the new item.
|
||||||
recent_files[0] = (char*)malloc(strlen(filename) + 1); //mbg merge 7/17/06 added cast
|
bufferArray[0] = (char*)malloc(strlen(addString) + 1); //mbg merge 7/17/06 added cast
|
||||||
strcpy(recent_files[0], filename);
|
strcpy(bufferArray[0], addString);
|
||||||
|
|
||||||
// Update the recent files menu
|
// Update the recent files menu
|
||||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
UpdateRMenu(menu, bufferArray, menuItem, baseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRecentDir(char *fn)
|
/**
|
||||||
|
* Add a filename to the recent files list.
|
||||||
|
*
|
||||||
|
* @param filename Name of the file to add.
|
||||||
|
**/
|
||||||
|
void AddRecentFile(const char *filename)
|
||||||
{
|
{
|
||||||
int x;
|
UpdateRecentArray(filename, recent_files, MAX_NUMBER_OF_RECENT_FILES, recentmenu, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||||
|
|
||||||
for(x=0;x<10;x++)
|
|
||||||
if(rdirs[x])
|
|
||||||
if(!strcmp(rdirs[x],fn)) // Item is already in list.
|
|
||||||
{
|
|
||||||
int y;
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
tmp=rdirs[x]; // Save pointer.
|
|
||||||
for(y=x;y;y--)
|
|
||||||
rdirs[y]=rdirs[y-1]; // Move items down.
|
|
||||||
|
|
||||||
rdirs[0]=tmp; // Put item on top.
|
|
||||||
UpdateRMenu(recentdmenu, rdirs, 103, 700);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rdirs[9]) free(rdirs[9]);
|
/**
|
||||||
for(x=9;x;x--) rdirs[x]=rdirs[x-1];
|
* Add a directory to the recent directories list.
|
||||||
rdirs[0]=(char *)malloc(strlen(fn)+1); //mbg merge 7/17/06 added cast
|
*
|
||||||
strcpy(rdirs[0],fn);
|
* @param dirname Name of the directory to add.
|
||||||
UpdateRMenu(recentdmenu, rdirs, 103, 700);
|
**/
|
||||||
|
void AddRecentDirectory(const char *dirname)
|
||||||
|
{
|
||||||
|
UpdateRecentArray(dirname, recent_directories, MAX_NUMBER_OF_RECENT_DIRS, recentdmenu, 103, 700);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -385,7 +425,6 @@ void HideMenu(unsigned int hide_menu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static LONG WindowXC=1<<30,WindowYC;
|
|
||||||
void HideFWindow(int h)
|
void HideFWindow(int h)
|
||||||
{
|
{
|
||||||
LONG desa;
|
LONG desa;
|
||||||
|
@ -404,6 +443,7 @@ void HideFWindow(int h)
|
||||||
{
|
{
|
||||||
desa = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS;
|
desa = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS;
|
||||||
HideMenu(tog);
|
HideMenu(tog);
|
||||||
|
|
||||||
/* Stupid DirectDraw bug(I think?) requires this. Need to investigate it. */
|
/* Stupid DirectDraw bug(I think?) requires this. Need to investigate it. */
|
||||||
SetWindowPos(hAppWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOSIZE);
|
SetWindowPos(hAppWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOREPOSITION | SWP_NOSIZE);
|
||||||
}
|
}
|
||||||
|
@ -440,19 +480,31 @@ static void ALoad(char *nameo)
|
||||||
if(FCEUI_LoadGame(nameo, 1))
|
if(FCEUI_LoadGame(nameo, 1))
|
||||||
{
|
{
|
||||||
pal_emulation = FCEUI_GetCurrentVidSystem(0, 0);
|
pal_emulation = FCEUI_GetCurrentVidSystem(0, 0);
|
||||||
|
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
|
|
||||||
FixFL();
|
FixFL();
|
||||||
|
|
||||||
SetMainWindowStuff();
|
SetMainWindowStuff();
|
||||||
AddRecent(nameo);
|
|
||||||
|
AddRecentFile(nameo);
|
||||||
|
|
||||||
RefreshThrottleFPS();
|
RefreshThrottleFPS();
|
||||||
|
|
||||||
if(eoptions & EO_HIDEMENU && !tog)
|
if(eoptions & EO_HIDEMENU && !tog)
|
||||||
|
{
|
||||||
ToggleHideMenu();
|
ToggleHideMenu();
|
||||||
|
}
|
||||||
|
|
||||||
if(eoptions & EO_FSAFTERLOAD)
|
if(eoptions & EO_FSAFTERLOAD)
|
||||||
|
{
|
||||||
SetFSVideoMode();
|
SetFSVideoMode();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParseGIInput(GameInfo);
|
ParseGIInput(GameInfo);
|
||||||
RedoMenuGI(GameInfo);
|
|
||||||
|
updateGameDependentMenus(GameInfo != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -493,7 +545,7 @@ void LoadNewGamey(HWND hParent, const char *initialdir)
|
||||||
tmpdir[ofn.nFileOffset]=0;
|
tmpdir[ofn.nFileOffset]=0;
|
||||||
|
|
||||||
// Add the directory to the list of recent directories
|
// Add the directory to the list of recent directories
|
||||||
AddRecentDir(tmpdir);
|
AddRecentDirectory(tmpdir);
|
||||||
|
|
||||||
// Prevent setting the File->Open default
|
// Prevent setting the File->Open default
|
||||||
// directory when a "Recent Directory" is selected.
|
// directory when a "Recent Directory" is selected.
|
||||||
|
@ -516,14 +568,16 @@ void LoadNewGamey(HWND hParent, const char *initialdir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32 mousex,mousey,mouseb;
|
|
||||||
void GetMouseData(uint32 *md)
|
void GetMouseData(uint32 *md)
|
||||||
{
|
{
|
||||||
if(FCEUI_IsMovieActive() < 0)
|
if(FCEUI_IsMovieActive() < 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
md[0] = mousex;
|
md[0] = mousex;
|
||||||
md[1] = mousey;
|
md[1] = mousey;
|
||||||
|
|
||||||
if(!fullscreen)
|
if(!fullscreen)
|
||||||
{
|
{
|
||||||
if(ismaximized)
|
if(ismaximized)
|
||||||
|
@ -538,6 +592,7 @@ void GetMouseData(uint32 *md)
|
||||||
md[0] /= winsizemulx;
|
md[0] /= winsizemulx;
|
||||||
md[1] /= winsizemuly;
|
md[1] /= winsizemuly;
|
||||||
}
|
}
|
||||||
|
|
||||||
md[0] += VNSCLIP;
|
md[0] += VNSCLIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,26 +600,11 @@ void GetMouseData(uint32 *md)
|
||||||
md[2] = ((mouseb == MK_LBUTTON) ? 1 : 0) | (( mouseb == MK_RBUTTON ) ? 2 : 0);
|
md[2] = ((mouseb == MK_LBUTTON) ? 1 : 0) | (( mouseb == MK_RBUTTON ) ? 2 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static int sizchange=0;
|
|
||||||
static int vchanged=0;
|
|
||||||
|
|
||||||
extern void RestartMovieOrReset(unsigned int pow);
|
|
||||||
|
|
||||||
int KeyboardSetBackgroundAccess(int on); //mbg merge 7/17/06 YECH had to add
|
|
||||||
void SetJoystickBackgroundAccess(int background); //mbg merge 7/17/06 YECH had to add
|
|
||||||
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
|
|
||||||
int FCEUMOV_IsPlaying(void); //mbg merge 7/17/06 YECH had to add
|
|
||||||
void DoPPUView();//mbg merge 7/19/06 yech had to add
|
|
||||||
|
|
||||||
void MapInput(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message loop of the main window
|
* Message loop of the main window
|
||||||
**/
|
**/
|
||||||
LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
{
|
{
|
||||||
DSMFix(msg);
|
|
||||||
|
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
|
@ -674,111 +714,151 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
else if(wParam >= 700 && wParam <= 709) // Recent dirs
|
else if(wParam >= 700 && wParam <= 709) // Recent dirs
|
||||||
{
|
{
|
||||||
// TODO: Do menu items 700 - 709 even exist?
|
// TODO: Do menu items 700 - 709 even exist?
|
||||||
if(rdirs[wParam-700])
|
if(recent_directories[wParam-700])
|
||||||
LoadNewGamey(hWnd, rdirs[wParam - 700]);
|
LoadNewGamey(hWnd, recent_directories[wParam - 700]);
|
||||||
}
|
}
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
//-------
|
//-------
|
||||||
//mbg merge 7/18/06 added XD tools
|
//mbg merge 7/18/06 added XD tools
|
||||||
case ID_DEBUG_DEBUGGER: DoDebug(0); break;
|
case MENU_DEBUGGER:
|
||||||
case ID_DEBUG_PPUVIEWER: DoPPUView(); break;
|
DoDebug(0);
|
||||||
case ID_DEBUG_NAMETABLEVIEWER: DoNTView(); break;
|
break;
|
||||||
case ID_DEBUG_HEXEDITOR: DoMemView(); break;
|
|
||||||
case ID_DEBUG_TRACELOGGER: DoTracer(); break;
|
|
||||||
case ID_DEBUG_GAMEGENIEDECODER: DoGGConv(); break;
|
|
||||||
case ID_DEBUG_CDLOGGER: DoCDLogger(); break;
|
|
||||||
|
|
||||||
case 40004:
|
case MENU_PPUVIEWER:
|
||||||
|
DoPPUView();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_NAMETABLEVIEWER:
|
||||||
|
DoNTView();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_HEXEDITOR:
|
||||||
|
DoMemView();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_TRACELOGGER:
|
||||||
|
DoTracer();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_GAMEGENIEDECODER:
|
||||||
|
DoGGConv();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_CDLOGGER:
|
||||||
|
DoCDLogger();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_1:
|
||||||
SetAutoFirePattern(1,1);
|
SetAutoFirePattern(1,1);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40005:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_2:
|
||||||
SetAutoFirePattern(1,2);
|
SetAutoFirePattern(1,2);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40006:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_3:
|
||||||
SetAutoFirePattern(1,3);
|
SetAutoFirePattern(1,3);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40007:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_4:
|
||||||
SetAutoFirePattern(1,4);
|
SetAutoFirePattern(1,4);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40008:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_5:
|
||||||
SetAutoFirePattern(1,5);
|
SetAutoFirePattern(1,5);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40009:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_6:
|
||||||
SetAutoFirePattern(2,1);
|
SetAutoFirePattern(2,1);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40010:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_7:
|
||||||
SetAutoFirePattern(2,2);
|
SetAutoFirePattern(2,2);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40011:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_8:
|
||||||
SetAutoFirePattern(2,3);
|
SetAutoFirePattern(2,3);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40012:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_9:
|
||||||
SetAutoFirePattern(2,4);
|
SetAutoFirePattern(2,4);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40013:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_10:
|
||||||
SetAutoFirePattern(3,1);
|
SetAutoFirePattern(3,1);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40014:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_11:
|
||||||
SetAutoFirePattern(3,2);
|
SetAutoFirePattern(3,2);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40015:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_12:
|
||||||
SetAutoFirePattern(3,3);
|
SetAutoFirePattern(3,3);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40022:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_13:
|
||||||
SetAutoFirePattern(4,1);
|
SetAutoFirePattern(4,1);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40023:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_14:
|
||||||
SetAutoFirePattern(4,2);
|
SetAutoFirePattern(4,2);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40024:
|
|
||||||
|
case MENU_AUTOFIRE_PATTERN_15:
|
||||||
SetAutoFirePattern(5,1);
|
SetAutoFirePattern(5,1);
|
||||||
CheckedAutoFirePattern = wParam;
|
CheckedAutoFirePattern = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40016:
|
|
||||||
case 40017:
|
case MENU_AUTOFIRE_OFFSET_1:
|
||||||
case 40018:
|
case MENU_AUTOFIRE_OFFSET_2:
|
||||||
case 40019:
|
case MENU_AUTOFIRE_OFFSET_3:
|
||||||
case 40020:
|
case MENU_AUTOFIRE_OFFSET_4:
|
||||||
case 40021:
|
case MENU_AUTOFIRE_OFFSET_5:
|
||||||
SetAutoFireOffset(wParam - 40016);
|
case MENU_AUTOFIRE_OFFSET_6:
|
||||||
|
SetAutoFireOffset(wParam - MENU_AUTOFIRE_OFFSET_1);
|
||||||
CheckedAutoFireOffset = wParam;
|
CheckedAutoFireOffset = wParam;
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
case 40025:
|
|
||||||
|
case MENU_ALTERNATE_AB:
|
||||||
SetAutoFireDesynch(GetAutoFireDesynch()^1);
|
SetAutoFireDesynch(GetAutoFireDesynch()^1);
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_EXTERNAL_INPUT:
|
||||||
|
// TODO: ???
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_HIDE_MENU:
|
case MENU_HIDE_MENU:
|
||||||
// Hide menu menu was selected
|
// Hide menu menu was selected
|
||||||
ToggleHideMenu();
|
ToggleHideMenu();
|
||||||
|
@ -944,7 +1024,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
{
|
{
|
||||||
FCEUI_CloseGame();
|
FCEUI_CloseGame();
|
||||||
GameInfo = 0;
|
GameInfo = 0;
|
||||||
RedoMenuGI(GameInfo);
|
updateGameDependentMenus(GameInfo != 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1177,9 +1257,6 @@ void FixWXY(int pref)
|
||||||
|
|
||||||
void UpdateFCEUWindow(void)
|
void UpdateFCEUWindow(void)
|
||||||
{
|
{
|
||||||
//int w,h; //mbg merge 7/17/06 removed
|
|
||||||
// RECT wrect; //mbg merge 7/17/06 removed
|
|
||||||
|
|
||||||
if(vchanged && !fullscreen && !changerecursive && !nofocus)
|
if(vchanged && !fullscreen && !changerecursive && !nofocus)
|
||||||
{
|
{
|
||||||
SetVideoMode(0);
|
SetVideoMode(0);
|
||||||
|
@ -1188,31 +1265,20 @@ void UpdateFCEUWindow(void)
|
||||||
|
|
||||||
BlockingCheck();
|
BlockingCheck();
|
||||||
|
|
||||||
//mbg merge 7/18/06 removed as part of old debugger
|
|
||||||
//#ifdef FCEUDEF_DEBUGGER
|
|
||||||
//UpdateDebugger();
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
if(!(eoptions & EO_BGRUN))
|
if(!(eoptions & EO_BGRUN))
|
||||||
|
{
|
||||||
while(nofocus)
|
while(nofocus)
|
||||||
{
|
{
|
||||||
|
|
||||||
Sleep(75);
|
Sleep(75);
|
||||||
BlockingCheck();
|
BlockingCheck();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//mbg merge 7/19/06 removing this since I think its not used
|
|
||||||
//if(_userpause) //mbg merge 7/18/06 this changed. even though theres nothing setting this..
|
|
||||||
//{
|
|
||||||
//
|
|
||||||
// while(_userpause) //mbg merge 7/18/06 this changed. even though theres nothing setting this..
|
|
||||||
// {
|
|
||||||
// Sleep(50);
|
|
||||||
// BlockingCheck();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the main window
|
||||||
|
**/
|
||||||
void ByebyeWindow(void)
|
void ByebyeWindow(void)
|
||||||
{
|
{
|
||||||
SetMenu(hAppWnd, 0);
|
SetMenu(hAppWnd, 0);
|
||||||
|
@ -1220,11 +1286,18 @@ void ByebyeWindow(void)
|
||||||
DestroyWindow(hAppWnd);
|
DestroyWindow(hAppWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the main window.
|
||||||
|
*
|
||||||
|
* @return Flag that indicates failure (0) or success (1)
|
||||||
|
**/
|
||||||
int CreateMainWindow(void)
|
int CreateMainWindow(void)
|
||||||
{
|
{
|
||||||
WNDCLASSEX winclass;
|
WNDCLASSEX winclass;
|
||||||
RECT tmp;
|
RECT tmp;
|
||||||
|
|
||||||
|
// Create and register the window class
|
||||||
|
|
||||||
memset(&winclass, 0, sizeof(winclass));
|
memset(&winclass, 0, sizeof(winclass));
|
||||||
winclass.cbSize = sizeof(WNDCLASSEX);
|
winclass.cbSize = sizeof(WNDCLASSEX);
|
||||||
winclass.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_SAVEBITS;
|
winclass.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW | CS_SAVEBITS;
|
||||||
|
@ -1252,14 +1325,23 @@ int CreateMainWindow(void)
|
||||||
|
|
||||||
// Update recent files menu
|
// Update recent files menu
|
||||||
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
UpdateRMenu(recentmenu, recent_files, MENU_RECENT_FILES, MENU_FIRST_RECENT_FILE);
|
||||||
UpdateRMenu(recentdmenu, rdirs, 103, 700);
|
UpdateRMenu(recentdmenu, recent_directories, 103, 700);
|
||||||
|
|
||||||
RedoMenuGI(NULL);
|
updateGameDependentMenus(0);
|
||||||
|
|
||||||
hAppWnd = CreateWindowEx(0,"FCEULTRA","FCE Ultra",
|
hAppWnd = CreateWindowEx(
|
||||||
|
0,
|
||||||
|
"FCEULTRA",
|
||||||
|
"FCE Ultra",
|
||||||
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, /* Style */
|
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS, /* Style */
|
||||||
CW_USEDEFAULT,CW_USEDEFAULT,256,240, /* X,Y ; Width, Height */
|
CW_USEDEFAULT,
|
||||||
NULL,fceumenu,fceu_hInstance,NULL );
|
CW_USEDEFAULT,
|
||||||
|
256,
|
||||||
|
240, /* X,Y ; Width, Height */
|
||||||
|
NULL,
|
||||||
|
fceumenu,
|
||||||
|
fceu_hInstance,
|
||||||
|
NULL );
|
||||||
|
|
||||||
DragAcceptFiles(hAppWnd, 1);
|
DragAcceptFiles(hAppWnd, 1);
|
||||||
|
|
||||||
|
@ -1268,8 +1350,7 @@ int CreateMainWindow(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMainWindowStuff(void)
|
||||||
int SetMainWindowStuff(void)
|
|
||||||
{
|
{
|
||||||
RECT tmp;
|
RECT tmp;
|
||||||
|
|
||||||
|
@ -1303,22 +1384,35 @@ int SetMainWindowStuff(void)
|
||||||
|
|
||||||
CalcWindowSize(&srect);
|
CalcWindowSize(&srect);
|
||||||
|
|
||||||
SetWindowPos(hAppWnd,HWND_TOP,tmp.left,tmp.top,srect.right,srect.bottom,SWP_SHOWWINDOW);
|
SetWindowPos(
|
||||||
|
hAppWnd,
|
||||||
|
HWND_TOP,
|
||||||
|
tmp.left,
|
||||||
|
tmp.top,
|
||||||
|
srect.right,
|
||||||
|
srect.bottom,
|
||||||
|
SWP_SHOWWINDOW
|
||||||
|
);
|
||||||
|
|
||||||
winwidth = srect.right;
|
winwidth = srect.right;
|
||||||
winheight = srect.bottom;
|
winheight = srect.bottom;
|
||||||
|
|
||||||
ShowWindow(hAppWnd, SW_SHOWNORMAL);
|
ShowWindow(hAppWnd, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Flag that indicates failure (0) or success (1).
|
||||||
|
**/
|
||||||
int GetClientAbsRect(LPRECT lpRect)
|
int GetClientAbsRect(LPRECT lpRect)
|
||||||
{
|
{
|
||||||
POINT point;
|
POINT point;
|
||||||
point.x = point.y = 0;
|
point.x = point.y = 0;
|
||||||
if(!ClientToScreen(hAppWnd,&point)) return 0;
|
|
||||||
|
if(!ClientToScreen(hAppWnd, &point))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
lpRect->top = point.y;
|
lpRect->top = point.y;
|
||||||
lpRect->left = point.x;
|
lpRect->left = point.x;
|
||||||
|
@ -1338,12 +1432,19 @@ int GetClientAbsRect(LPRECT lpRect)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
int LoadPaletteFile(void)
|
* Prompts the user for a palette file and opens that file.
|
||||||
|
*
|
||||||
|
* @return Flag that indicates failure (0) or success (1)
|
||||||
|
**/
|
||||||
|
int LoadPaletteFile()
|
||||||
{
|
{
|
||||||
FILE *fp;
|
|
||||||
const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0";
|
const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0";
|
||||||
|
|
||||||
|
FILE *fp;
|
||||||
char nameo[2048];
|
char nameo[2048];
|
||||||
|
|
||||||
|
// Display open file dialog
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
memset(&ofn, 0, sizeof(ofn));
|
memset(&ofn, 0, sizeof(ofn));
|
||||||
ofn.lStructSize = sizeof(ofn);
|
ofn.lStructSize = sizeof(ofn);
|
||||||
|
@ -1355,30 +1456,33 @@ int LoadPaletteFile(void)
|
||||||
ofn.nMaxFile = 256;
|
ofn.nMaxFile = 256;
|
||||||
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
|
||||||
ofn.lpstrInitialDir = 0;
|
ofn.lpstrInitialDir = 0;
|
||||||
|
|
||||||
if(GetOpenFileName(&ofn))
|
if(GetOpenFileName(&ofn))
|
||||||
{
|
{
|
||||||
if((fp = FCEUD_UTF8fopen(nameo, "rb")))
|
if((fp = FCEUD_UTF8fopen(nameo, "rb")))
|
||||||
{
|
{
|
||||||
fread(cpalette, 1, 192, fp);
|
fread(cpalette, 1, 192, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
FCEUI_SetPaletteArray(cpalette);
|
FCEUI_SetPaletteArray(cpalette);
|
||||||
|
|
||||||
eoptions |= EO_CPALETTE;
|
eoptions |= EO_CPALETTE;
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
FCEUD_PrintError("Error opening palette file!");
|
FCEUD_PrintError("Error opening palette file!");
|
||||||
}
|
}
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
static HWND pwindow;
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback function for the palette configuration dialog.
|
* Callback function for the palette configuration dialog.
|
||||||
**/
|
**/
|
||||||
BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
DSMFix(uMsg);
|
|
||||||
|
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
@ -1808,13 +1912,11 @@ void ConfigDirectories(void)
|
||||||
DialogBox(fceu_hInstance, "DIRCONFIG", hAppWnd, DirConCallB);
|
DialogBox(fceu_hInstance, "DIRCONFIG", hAppWnd, DirConCallB);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ReplayDialogReadOnlyStatus = 0;
|
|
||||||
static int ReplayDialogStopFrame = 0;
|
|
||||||
|
|
||||||
static char* GetReplayPath(HWND hwndDlg)
|
static char* GetReplayPath(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
char* fn=0;
|
char* fn=0;
|
||||||
char szChoice[MAX_PATH];
|
char szChoice[MAX_PATH];
|
||||||
|
|
||||||
LONG lIndex = SendDlgItemMessage(hwndDlg, 200, CB_GETCURSEL, 0, 0);
|
LONG lIndex = SendDlgItemMessage(hwndDlg, 200, CB_GETCURSEL, 0, 0);
|
||||||
LONG lCount = SendDlgItemMessage(hwndDlg, 200, CB_GETCOUNT, 0, 0);
|
LONG lCount = SendDlgItemMessage(hwndDlg, 200, CB_GETCOUNT, 0, 0);
|
||||||
|
|
||||||
|
@ -1928,9 +2030,6 @@ void AbsoluteToRelative(char *const dst, const char *const dir, const char *cons
|
||||||
strcpy(dst, dir + igood);
|
strcpy(dst, dir + igood);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int movieConvertOffset1, movieConvertOffset2,movieConvertOK;
|
|
||||||
static int movieHackType=3;
|
|
||||||
|
|
||||||
static void UpdateReplayDialog(HWND hwndDlg)
|
static void UpdateReplayDialog(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
movieConvertOffset1=0, movieConvertOffset2=0,movieConvertOK=0;
|
movieConvertOffset1=0, movieConvertOffset2=0,movieConvertOK=0;
|
||||||
|
@ -2127,11 +2226,6 @@ static void UpdateReplayDialog(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX(x,y) ((x)<(y)?(y):(x))
|
|
||||||
#define MIN(x,y) ((x)>(y)?(y):(x))
|
|
||||||
|
|
||||||
static BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
|
@ -2480,14 +2574,6 @@ static void UpdateRecordDialog(HWND hwndDlg)
|
||||||
EnableWindow(GetDlgItem(hwndDlg,1),enable ? TRUE : FALSE);
|
EnableWindow(GetDlgItem(hwndDlg,1),enable ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CreateMovieParameters
|
|
||||||
{
|
|
||||||
char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose.
|
|
||||||
int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename
|
|
||||||
char* szSavestateFilename;
|
|
||||||
WCHAR metadata[MOVIE_MAX_METADATA];
|
|
||||||
};
|
|
||||||
|
|
||||||
static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static struct CreateMovieParameters* p = NULL;
|
static struct CreateMovieParameters* p = NULL;
|
||||||
|
|
11
src/fceu.cpp
11
src/fceu.cpp
|
@ -232,18 +232,29 @@ static void CloseGame(void)
|
||||||
if(GameInfo)
|
if(GameInfo)
|
||||||
{
|
{
|
||||||
if(FCEUnetplay)
|
if(FCEUnetplay)
|
||||||
|
{
|
||||||
FCEUD_NetworkClose();
|
FCEUD_NetworkClose();
|
||||||
|
}
|
||||||
|
|
||||||
FCEUI_StopMovie();
|
FCEUI_StopMovie();
|
||||||
|
|
||||||
if(GameInfo->name)
|
if(GameInfo->name)
|
||||||
{
|
{
|
||||||
free(GameInfo->name);
|
free(GameInfo->name);
|
||||||
GameInfo->name=0;
|
GameInfo->name=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GameInfo->type!=GIT_NSF)
|
if(GameInfo->type!=GIT_NSF)
|
||||||
|
{
|
||||||
FCEU_FlushGameCheats(0,0);
|
FCEU_FlushGameCheats(0,0);
|
||||||
|
}
|
||||||
|
|
||||||
GameInterface(GI_CLOSE);
|
GameInterface(GI_CLOSE);
|
||||||
|
|
||||||
ResetExState(0,0);
|
ResetExState(0,0);
|
||||||
|
|
||||||
CloseGenie();
|
CloseGenie();
|
||||||
|
|
||||||
free(GameInfo);
|
free(GameInfo);
|
||||||
GameInfo = 0;
|
GameInfo = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue