Commit dec64a5d authored by OV2's avatar OV2
Browse files

Update win32-dev branch to 1.52fix4

parent d1666860
......@@ -266,6 +266,7 @@ inline uint8 S9xGetByte (uint32 Address)
inline uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w = WRAP_NONE)
{
uint16 ret;
uint32 mask = MEMMAP_MASK & (w == WRAP_PAGE ? 0xff : (w == WRAP_BANK ? 0xffff : 0xffffff));
if ((Address & mask) == mask)
{
......@@ -309,7 +310,8 @@ inline uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w = WRAP_NONE)
switch ((pint) GetAddress)
{
case CMemory::MAP_CPU:
return (S9xGetCPU(Address & 0xffff) | (S9xGetCPU((Address + 1) & 0xffff) << 8));
ret = S9xGetCPU(Address & 0xffff);
return (ret | (S9xGetCPU((Address + 1) & 0xffff) << 8));
case CMemory::MAP_PPU:
if (CPU.InDMAorHDMA)
......@@ -317,8 +319,9 @@ inline uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w = WRAP_NONE)
OpenBus = S9xGetByte(Address);
return (OpenBus | (S9xGetByte(Address + 1) << 8));
}
return (S9xGetPPU(Address & 0xffff) | (S9xGetPPU((Address + 1) & 0xffff) << 8));
ret = S9xGetPPU(Address & 0xffff);
return (ret | (S9xGetPPU((Address + 1) & 0xffff) << 8));
case CMemory::MAP_LOROM_SRAM:
case CMemory::MAP_SA1RAM:
......@@ -347,28 +350,36 @@ inline uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w = WRAP_NONE)
return (READ_WORD(Memory.BWRAM + ((Address & 0x7fff) - 0x6000)));
case CMemory::MAP_DSP:
return (S9xGetDSP(Address & 0xffff) | (S9xGetDSP((Address + 1) & 0xffff) << 8));
ret = S9xGetDSP(Address & 0xffff);
return (ret | (S9xGetDSP((Address + 1) & 0xffff) << 8));
case CMemory::MAP_SPC7110_ROM:
return (S9xGetSPC7110Byte(Address) | (S9xGetSPC7110Byte(Address + 1) << 8));
ret = S9xGetSPC7110Byte(Address);
return (ret | (S9xGetSPC7110Byte(Address + 1) << 8));
case CMemory::MAP_SPC7110_DRAM:
return (S9xGetSPC7110(0x4800) | (S9xGetSPC7110(0x4800) << 8));
ret = S9xGetSPC7110(0x4800);
return (ret | (S9xGetSPC7110(0x4800) << 8));
case CMemory::MAP_C4:
return (S9xGetC4(Address & 0xffff) | (S9xGetC4((Address + 1) & 0xffff) << 8));
ret = S9xGetC4(Address & 0xffff);
return (ret | (S9xGetC4((Address + 1) & 0xffff) << 8));
case CMemory::MAP_OBC_RAM:
return (S9xGetOBC1(Address & 0xffff) | (S9xGetOBC1((Address + 1) & 0xffff) << 8));
ret = S9xGetOBC1(Address & 0xffff);
return (ret | (S9xGetOBC1((Address + 1) & 0xffff) << 8));
case CMemory::MAP_SETA_DSP:
return (S9xGetSetaDSP(Address) | (S9xGetSetaDSP(Address + 1) << 8));
ret = S9xGetSetaDSP(Address);
return (ret | (S9xGetSetaDSP(Address + 1) << 8));
case CMemory::MAP_SETA_RISC:
return (S9xGetST018(Address) | (S9xGetST018(Address + 1) << 8));
ret = S9xGetST018(Address);
return (ret | (S9xGetST018(Address + 1) << 8));
case CMemory::MAP_BSX:
return (S9xGetBSX(Address) | (S9xGetBSX(Address + 1) << 8));
ret = S9xGetBSX(Address);
return (ret | (S9xGetBSX(Address + 1) << 8));
case CMemory::MAP_NONE:
default:
......
......@@ -300,6 +300,8 @@ void _makepath (char *, const char *, const char *, const char *, const char *);
#define strncasecmp strnicmp
void WinDisplayStringFromBottom(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap);
#define S9xDisplayString WinDisplayStringFromBottom
void SetInfoDlgColor(unsigned char, unsigned char, unsigned char);
#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b)
#endif
#ifdef __DJGPP
......
......@@ -191,8 +191,6 @@
#include "../filter/hq2x.h"
#include "../filter/2xsai.h"
#define RenderMethod ((Src.Height > SNES_HEIGHT_EXTENDED || Src.Width == 512) ? RenderMethodHiRes : RenderMethod)
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
......@@ -345,7 +343,7 @@ void CDirect3D::Render(SSurface Src)
ResetDevice();
return;
default:
DXTRACE_ERR( TEXT("Internal driver error"), hr);
DXTRACE_ERR_MSGBOX( TEXT("Internal driver error"), hr);
return;
}
}
......@@ -362,8 +360,8 @@ void CDirect3D::Render(SSurface Src)
RenderMethod (Src, Dst, &dstRect);
if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(GUI.Scale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(GUI.Scale));
WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
}
drawSurface->UnlockRect(0);
......
......@@ -561,11 +561,11 @@ void CDirectDraw::Render(SSurface Src)
if (!GUI.DepthConverted)
{
SSurface tmp;
static BYTE buf [256 * 239 * 4*3*3];
static BYTE buf[SNES_WIDTH * sizeof(uint16) * SNES_HEIGHT_EXTENDED * sizeof(uint16) *4*4];
tmp.Surface = buf;
if(GUI.Scale == FILTER_NONE) {
if(CurrentScale == FILTER_NONE) {
tmp.Pitch = Src.Pitch;
tmp.Width = Src.Width;
tmp.Height = Src.Height;
......@@ -583,8 +583,8 @@ void CDirectDraw::Render(SSurface Src)
}
if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, (Dst.Pitch*8/GUI.ScreenDepth), srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(GUI.Scale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(GUI.Scale));
WinSetCustomDisplaySurface((void *)Dst.Surface, (Dst.Pitch*8/GUI.ScreenDepth), srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(CurrentScale));
}
RECT lastRect = SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames];
......
......@@ -202,7 +202,6 @@ CDirectSound::CDirectSound()
bufferSize = 0;
blockSamples = 0;
hTimer = NULL;
hTimerQueue = NULL;
}
CDirectSound::~CDirectSound()
......@@ -268,12 +267,6 @@ opened DirectSound in exclusive mode."),
}
}
hTimerQueue = CreateTimerQueue();
if(!hTimerQueue) {
DeInitDirectSound();
return false;
}
return (initDone);
}
......@@ -292,10 +285,6 @@ void CDirectSound::DeInitDirectSound()
lpDS->Release ();
lpDS = NULL;
}
if(hTimerQueue) {
DeleteTimerQueueEx(hTimer,NULL);
hTimerQueue = NULL;
}
}
/* CDirectSound::InitSoundBuffer
......@@ -371,8 +360,7 @@ deinitializes the DirectSound/temp buffers and stops the mixing timer
void CDirectSound::DeInitSoundBuffer()
{
if(hTimer) {
if(!DeleteTimerQueueTimer(hTimerQueue,hTimer,INVALID_HANDLE_VALUE))
DeleteTimerQueueTimer(hTimerQueue,hTimer,INVALID_HANDLE_VALUE);
timeKillEvent(hTimer);
hTimer = NULL;
}
if( lpDSB != NULL)
......@@ -428,8 +416,8 @@ bool CDirectSound::SetupSound()
last_block = blockCount - 1;
if(!CreateTimerQueueTimer(&hTimer,hTimerQueue,SoundTimerCallback,(void *)this,blockTime/2,blockTime/2,WT_EXECUTEINIOTHREAD)) {
hTimer = timeSetEvent (blockTime/2, blockTime/2, SoundTimerCallback, (DWORD_PTR)this, TIME_PERIODIC);
if(!hTimer) {
DeInitSoundBuffer();
return false;
}
......@@ -460,6 +448,8 @@ void CDirectSound::MixSound()
HRESULT hResult;
DWORD curr_block;
if(!initDone)
return;
lpDSB->GetCurrentPosition (&play_pos, NULL);
......@@ -509,8 +499,9 @@ void CDirectSound::MixSound()
/* CDirectSound::SoundTimerCallback
Timer callback that tries to mix a new block. Called twice each block.
*/
VOID CALLBACK CDirectSound::SoundTimerCallback(PVOID lpParameter,BOOLEAN TimerOrWaitFired) {
CDirectSound *S9xDirectSound = (CDirectSound *)lpParameter;
VOID CALLBACK CDirectSound::SoundTimerCallback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) {
CDirectSound *S9xDirectSound = (CDirectSound *)dwUser;
S9xDirectSound->MixSound();
}
......@@ -206,10 +206,7 @@ private:
DWORD last_block; // the last block that was mixed
bool initDone; // has init been called successfully?
HANDLE hTimerQueue; // handle to the mixing thread
HANDLE hTimer;
volatile bool threadExit; // mixing thread exit signal
DWORD hTimer; // mixing timer
bool InitDirectSound ();
void DeInitDirectSound();
......@@ -217,7 +214,7 @@ private:
bool InitSoundBuffer();
void DeInitSoundBuffer();
static VOID CALLBACK CDirectSound::SoundTimerCallback(PVOID lpParameter,BOOLEAN TimerOrWaitFired);
static VOID CALLBACK SoundTimerCallback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
void ProcessSound();
void MixSound();
......
......@@ -373,6 +373,7 @@ inline static bool GetFilter32BitSupport(RenderFilter filterID)
case FILTER_SCANLINES:
case FILTER_TVMODE3X:
case FILTER_DOTMATRIX3X:
case FILTER_SIMPLE4X:
return true;
default:
......
......@@ -145,6 +145,7 @@
#define IDC_CLEAR_CHEATS 1126
#define IDC_JPTOGGLE 1126
#define IDC_LOCALVIDMEM 1126
#define IDC_VSYNC 1126
#define IDC_CHEAT_DESCRIPTION 1127
#define IDC_KEYBOARD 1127
#define IDC_ALLOWLEFTRIGHT 1127
......
......@@ -199,7 +199,7 @@ BEGIN
COMBOBOX IDC_FILTERBOX2,217,33,122,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Resolution",IDC_CURRMODE,187,71,41,8
COMBOBOX IDC_RESOLUTION,234,69,105,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,85,87,10
CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,86,87,10
CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,113,153,10
CONTROL "Hi Resolution Support",IDC_HIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,124,85,10
CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,135,111,10
......@@ -214,6 +214,7 @@ BEGIN
LTEXT "Max skipped frames:",IDC_STATIC,62,126,67,8
LTEXT "Amount skipped:",IDC_STATIC,62,144,67,8
LTEXT "Output Method",IDC_STATIC,10,19,51,11
CONTROL "VSync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,86,37,10
END
IDD_CHEATER DIALOGEX 0, 0, 262, 218
......
......@@ -147,10 +147,13 @@
<Tool
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="0"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="$(ProjectDir),$(ProjectDir)..\,$(ProjectDir)..\..\,$(ProjectDir)..\..\zLib,$(ProjectDir)..\unzip,$(ProjectDir)..\..\FMOD\api\inc,$(ProjectDir)..\..\libPNG\src,$(ProjectDir)..\snes9x"
PreprocessorDefinitions="NDEBUG;HAVE_LIBPNG;SPC700_C;JMA_SUPPORT;SDD1_DECOMP;CORRECT_VRAM_READS;SPC700_SHUTDOWN;CPU_SHUTDOWN;ZLIB;VAR_CYCLES;UNZIP_SUPPORT;EXECUTE_SUPERFX_PER_LINE;__WIN32__;__MSC__;FMODEX_SUPPORT;NEW_COLOUR_BLENDING;USE_OPENGL;NETPLAY_SUPPORT"
PreprocessorDefinitions="NDEBUG;HAVE_LIBPNG;SPC700_C;JMA_SUPPORT;SDD1_DECOMP;CORRECT_VRAM_READS;SPC700_SHUTDOWN;CPU_SHUTDOWN;ZLIB;VAR_CYCLES;UNZIP_SUPPORT;EXECUTE_SUPERFX_PER_LINE;__WIN32__;__MSC__;FMODEX_SUPPORT;NEW_COLOUR_BLENDING;NETPLAY_SUPPORT"
StringPooling="true"
RuntimeLibrary="0"
StructMemberAlignment="3"
......
......@@ -237,18 +237,18 @@ void WinSetDefaultValues ()
GUI.ValidControllerOptions = 0xFFFF;
GUI.IgnoreNextMouseMove = false;
GUI.HideMenu = false;
GUI.window_size.left = 0;
//GUI.HideMenu = false;
/*GUI.window_size.left = 0;
GUI.window_size.right = 524;
GUI.window_size.top = 0;
GUI.window_size.bottom = 524;
GUI.FullscreenMode.width = 640;
GUI.window_size.bottom = 524;*/
/*GUI.FullscreenMode.width = 640;
GUI.FullscreenMode.height = 480;
GUI.FullscreenMode.depth = 16;
GUI.Scale = FILTER_NONE;
GUI.NextScale = FILTER_NONE;
GUI.ScaleHiRes = FILTER_NONE;
GUI.NextScaleHiRes = FILTER_NONE;
GUI.NextScaleHiRes = FILTER_NONE;*/
GUI.DoubleBuffered = false;
GUI.FullScreen = false;
GUI.Stretch = false;
......@@ -262,29 +262,29 @@ void WinSetDefaultValues ()
WinDeleteRecentGamesList ();
// ROM Options
memset (&Settings, 0, sizeof (Settings));
//memset (&Settings, 0, sizeof (Settings));
Settings.ForceLoROM = false;
Settings.ForceInterleaved = false;
//Settings.ForceLoROM = false;
//Settings.ForceInterleaved = false;
Settings.ForceNotInterleaved = false;
Settings.ForceInterleaved = false;
Settings.ForceInterleaved2 = false;
//Settings.ForceNotInterleaved = false;
//Settings.ForceInterleaved = false;
//Settings.ForceInterleaved2 = false;
Settings.ForcePAL = false;
Settings.ForceNTSC = false;
Settings.ForceHeader = false;
Settings.ForceNoHeader = false;
//Settings.ForcePAL = false;
//Settings.ForceNTSC = false;
//Settings.ForceHeader = false;
//Settings.ForceNoHeader = false;
// Sound options
Settings.SoundSync = FALSE;
Settings.Mute = FALSE;
Settings.SoundPlaybackRate = 32000;
Settings.SixteenBitSound = TRUE;
Settings.Stereo = TRUE;
Settings.ReverseStereo = FALSE;
//Settings.SoundSync = FALSE;
//Settings.Mute = FALSE;
//Settings.SoundPlaybackRate = 32000;
//Settings.SixteenBitSound = TRUE;
//Settings.Stereo = TRUE;
//Settings.ReverseStereo = FALSE;
GUI.SoundChannelEnable=255;
GUI.FAMute = FALSE;
//GUI.FAMute = FALSE;
// Tracing options
Settings.TraceDMA = false;
......@@ -300,41 +300,41 @@ void WinSetDefaultValues ()
Settings.FrameTime = 16667;
// CPU options
Settings.HDMATimingHack = 100;
Settings.Shutdown = false;
Settings.ShutdownMaster = false;
Settings.BlockInvalidVRAMAccess = true;
Settings.DisableIRQ = false;
//Settings.HDMATimingHack = 100;
//Settings.Shutdown = false;
//Settings.ShutdownMaster = false;
//Settings.BlockInvalidVRAMAccess = true;
//Settings.DisableIRQ = false;
Settings.Paused = false;
Timings.H_Max = SNES_CYCLES_PER_SCANLINE;
Timings.HBlankStart = (256 * Timings.H_Max) / SNES_HCOUNTER_MAX;
Settings.SkipFrames = AUTO_FRAMERATE;
//Timings.H_Max = SNES_CYCLES_PER_SCANLINE;
//Timings.HBlankStart = (256 * Timings.H_Max) / SNES_HCOUNTER_MAX;
//Settings.SkipFrames = AUTO_FRAMERATE;
// ROM image and peripheral options
Settings.MultiPlayer5Master = false;
Settings.SuperScopeMaster = false;
Settings.MouseMaster = false;
Settings.SuperFX = false;
//Settings.SuperFX = false;
// SNES graphics options
Settings.DisableGraphicWindows = false;
Settings.DisableHDMA = false;
GUI.HeightExtend = false;
Settings.DisplayFrameRate = false;
//Settings.DisableGraphicWindows = false;
//Settings.DisableHDMA = false;
//GUI.HeightExtend = false;
//Settings.DisplayFrameRate = false;
// Settings.SixteenBit = true;
Settings.Transparency = true;
Settings.SupportHiRes = true;
Settings.AutoDisplayMessages = false; // this port supports text display on post-rendered surface
//Settings.Transparency = true;
//Settings.SupportHiRes = true;
//Settings.AutoDisplayMessages = false; // this port supports text display on post-rendered surface
Settings.DisplayPressedKeys = 0;
GUI.CurrentSaveSlot = 0;
Settings.AutoSaveDelay = 15;
Settings.ApplyCheats = true;
//Settings.DisplayPressedKeys = 0;
//GUI.CurrentSaveSlot = 0;
//Settings.AutoSaveDelay = 15;
//Settings.ApplyCheats = true;
Settings.TurboMode = false;
Settings.TurboSkipFrames = 15;
GUI.TurboModeToggle = true;
Settings.AutoMaxSkipFrames = 1;
//Settings.TurboMode = false;
//Settings.TurboSkipFrames = 15;
//GUI.TurboModeToggle = true;
//Settings.AutoMaxSkipFrames = 1;
#ifdef NETPLAY_SUPPORT
Settings.Port = 1996;
......@@ -344,11 +344,9 @@ void WinSetDefaultValues ()
NPServer.SendROMImageOnConnect = false;
#endif
GUI.FreezeFileDir [0] = 0;
//GUI.FreezeFileDir [0] = 0;
Settings.TakeScreenshot=false;
Settings.StretchScreenshots=1;
GUI.EmulatedFullscreen = false;
//Settings.StretchScreenshots=1;
GUI.Language=0;
}
......@@ -892,7 +890,6 @@ void WinPostSave(ConfigFile& conf)
void WinPostLoad(ConfigFile& conf)
{
int i;
GUI.NextScale = GUI.Scale;
if(Settings.DisplayPressedKeys) Settings.DisplayPressedKeys = 2;
for(i=0;i<8;i++) Joypad[i+8].Enabled = Joypad[i].Enabled;
if(GUI.MaxRecentGames < 1) GUI.MaxRecentGames = 1;
......@@ -975,7 +972,7 @@ void WinRegisterConfigItems()
AddBoolC("Stretch:MaintainAspectRatio", GUI.AspectRatio, true, "prevents stretching from changing the aspect ratio");
AddUIntC("Stretch:AspectRatioBaseWidth", GUI.AspectWidth, 256, "base width for aspect ratio calculation (AR=AspectRatioBaseWidth/224), default is 256 - set to 299 for 4:3 aspect ratio");
AddBoolC("Stretch:BilinearFilter", GUI.BilinearFilter, true, "allows bilinear filtering of stretching. Depending on your video card and the window size, this may result in a lower framerate.");
AddBoolC("Stretch:LocalVidMem", GUI.LocalVidMem, true, "determines the location of video memory, if UseVideoMemory = true. May increase or decrease rendering performance, depending on your setup and which filter and stretching options are active.");
AddBoolC("Stretch:LocalVidMem", GUI.LocalVidMem, true, "determines the location of video memory in DirectDraw mode. May increase or decrease rendering performance, depending on your setup and which filter and stretching options are active.");
AddBool("Fullscreen:Enabled", GUI.FullScreen, false);
AddUInt("Fullscreen:Width", GUI.FullscreenMode.width, 640);
AddUInt("Fullscreen:Height", GUI.FullscreenMode.height, 480);
......@@ -984,11 +981,11 @@ void WinRegisterConfigItems()
AddBool("Fullscreen:DoubleBuffered", GUI.DoubleBuffered, false);
AddBoolC("Fullscreen:EmulateFullscreen", GUI.EmulateFullscreen, true,"true makes snes9x create a window that spans the entire screen when going fullscreen");
AddBoolC("HideMenu", GUI.HideMenu, false, "true to auto-hide the menu bar on startup.");
AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync, only available with Direct3D");
AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync");
#undef CATEGORY
#define CATEGORY "Settings"
AddUIntC("FrameSkip", Settings.SkipFrames, AUTO_FRAMERATE, "200=automatic, 0=none, 1=skip every other, ...");
AddUIntC("AutoMaxSkipFramesAtOnce", Settings.AutoMaxSkipFrames, 0, "most frames to skip at once to maintain speed, don't set to more than 1 or 2 frames because the skipping algorithm isn't very smart");
AddUIntC("FrameSkip", Settings.SkipFrames, AUTO_FRAMERATE, "200=automatic (limits at 50/60 fps), 0=none, 1=skip every other, ...");
AddUIntC("AutoMaxSkipFramesAtOnce", Settings.AutoMaxSkipFrames, 0, "most frames to skip at once to maintain speed in automatic mode, don't set to more than 1 or 2 frames because the skipping algorithm isn't very smart");
AddUIntC("TurboFrameSkip", Settings.TurboSkipFrames, 15, "how many frames to skip when in fast-forward mode");
AddUInt("AutoSaveDelay", Settings.AutoSaveDelay, 30);
AddBool2C("SpeedHacks", Settings.ShutdownMaster, false, "on to skip emulating the CPU when it is not being used ... recommended OFF");
......@@ -1029,29 +1026,21 @@ void WinRegisterConfigItems()
ADD(25); ADD(26); ADD(27); ADD(28); ADD(29); ADD(30); ADD(31); ADD(32);
assert(MAX_RECENT_GAMES_LIST_SIZE == 32);
#undef ADD
AddString("Pack:StarOcean", GUI.StarOceanPack, _MAX_PATH, "");
AddString("Pack:FarEast", GUI.FEOEZPack, _MAX_PATH, "");
AddString("Pack:SFA2NTSC", GUI.SFA2NTSCPack, _MAX_PATH, "");
AddString("Pack:SFA2PAL", GUI.SFA2PALPack, _MAX_PATH, "");
AddString("Pack:Momotarou", GUI.MDHPack, _MAX_PATH, "");
AddString("Pack:SFZ2", GUI.SFZ2Pack, _MAX_PATH, "");
AddString("Pack:ShounenJump", GUI.SJNSPack, _MAX_PATH, "");
AddString("Pack:SPL4", GUI.SPL4Pack, _MAX_PATH, "");
AddString("Rom:MultiCartA", multiRomA, _MAX_PATH, "");
AddString("Rom:MultiCartB", multiRomB, _MAX_PATH, "");
#undef CATEGORY
#define CATEGORY "Sound"
AddIntC("Sync", Settings.SoundSync, 1, "1 to enable sound sync to CPU, 0 to disable. Necessary for some sounds to be accurate. Not supported unless SoundDriver=0. May cause sound problems on certain setups.");
AddIntC("Sync", Settings.SoundSync, 1, "1 to sync emulation to sound output, 0 to disable.");
AddBool2("Stereo", Settings.Stereo, true);
AddBool("SixteenBitSound", Settings.SixteenBitSound, true);
AddUIntC("Rate", Settings.SoundPlaybackRate, 32000, "sound playback quality, in Hz: 1=8000, 2=11025, 3=16000, 4=22050, 5=30000, 6=32000, 7=35000, 8=44100, 9=48000");
AddUIntC("InputRate", Settings.SoundInputRate, 31900, "");
AddUIntC("Rate", Settings.SoundPlaybackRate, 32000, "sound playback quality, in Hz");
AddUIntC("InputRate", Settings.SoundInputRate, 31900, "for each 'Input rate' samples generated by the SNES, 'Playback rate' samples will produced. If you experience crackling you can try to lower this setting.");
AddBoolC("ReverseStereo", Settings.ReverseStereo, false, "true to swap speaker outputs");
AddBoolC("Mute", GUI.Mute, false, "true to mute sound output (does not disable the sound CPU)");
#undef CATEGORY
#define CATEGORY "Sound\\Win"
AddUIntC("SoundDriver", GUI.SoundDriver, 4, "0=Snes9xDirectSound (recommended), 1=fmodDirectSound, 2=fmodWaveSound, 3=fmodA3DSound, 4=XAudio2");
AddUIntC("BufferSize", GUI.SoundBufferSize, 64, "sound buffer size - the mixing interval is multiplied by this (and an additional *4 in case of DirectSound) ");
AddUIntC("SoundDriver", GUI.SoundDriver, 4, "0=Snes9xDirectSound, 4=XAudio2 (recommended), 5=FMOD Default, 6=FMOD ASIO, 7=FMOD OpenAL");
AddUIntC("BufferSize", GUI.SoundBufferSize, 64, "sound buffer size in ms - determines the internal and output sound buffer sizes. actual mixing is done every SoundBufferSize/4 samples");
AddBoolC("MuteFrameAdvance", GUI.FAMute, false, "true to prevent Snes9x from outputting sound when the Frame Advance command is in use");
#undef CATEGORY
#define CATEGORY "Controls"
......@@ -1059,7 +1048,7 @@ void WinRegisterConfigItems()
#undef CATEGORY
#define CATEGORY "ROM"
AddBoolC("Cheat", Settings.ApplyCheats, true, "true to allow enabled cheats to be applied");
AddInvBoolC("Patch", Settings.NoPatch, true, "true to allow IPS patches to be applied (\"soft patching\")");
AddInvBoolC("Patch", Settings.NoPatch, true, "true to allow IPS/UPS patches to be applied (\"soft patching\")");
AddBoolC("BS", Settings.BS, false, "Broadcast Satellaview emulation");
AddStringC("Filename", rom_filename, MAX_PATH, "", "filename of ROM to run when Snes9x opens");
#undef CATEGORY
......
......@@ -1354,7 +1354,7 @@ void DoAVIClose(int reason)
void DoAVIVideoFrame(SSurface* source_surface, int Width, int Height/*, bool8 sixteen_bit*/)
{
static uint32 lastFrameCount=0;
if(!GUI.AVIOut || (IPPU.FrameCount==lastFrameCount))
if(!GUI.AVIOut || !avi_buffer || (IPPU.FrameCount==lastFrameCount))
{
return;
}
......
......@@ -266,8 +266,6 @@ bool8 S9xInitUpdate (void)
return (TRUE);
}
#define RenderMethod ((Src.Height > SNES_HEIGHT_EXTENDED || Src.Width == 512) ? RenderMethodHiRes : RenderMethod)
// only necessary for avi recording
// TODO: check if this can be removed
bool8 S9xContinueUpdate(int Width, int Height)
......@@ -687,6 +685,8 @@ void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect)
void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap)
{
if(Settings.StopEmulation)
return;
if(Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)GFX.Screen, GFX.RealPPL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, 1);
WinDisplayStringInBuffer<uint16>(string, linesFromBottom, pixelsFromLeft, allowWrap);
......
......@@ -182,6 +182,10 @@
#include "render.h"
#include <vector>
#define IsHiRes(x) ((x.Height > SNES_HEIGHT_EXTENDED || x.Width == 512))
#define RenderMethod (IsHiRes(Src) ? RenderMethodHiRes : RenderMethod)
#define CurrentScale (IsHiRes(Src) ? GUI.ScaleHiRes : GUI.Scale)
void WinRefreshDisplay(void);
void S9xSetWinPixelFormat ();
void SwitchToGDI();
......
......@@ -325,7 +325,7 @@
#define GAMEDEVICE_NUMPADPREFIX "Numpad-%c"
#define GAMEDEVICE_VK_TAB "Tab"
#define GAMEDEVICE_VK_BACK "Backspace"
#define GAMEDEVICE_VK_CLEAR "Delete"
#define GAMEDEVICE_VK_CLEAR "Clear"
#define GAMEDEVICE_VK_RETURN "Enter"
#define GAMEDEVICE_VK_LSHIFT "LShift"
#define GAMEDEVICE_VK_RSHIFT "RShift"
......
......@@ -1707,8 +1707,6 @@ LRESULT CALLBACK WinProc(
//end turbo
case ID_OPTIONS_DISPLAY:
{
int old_scale = GUI.NextScale;
RestoreGUIDisplay ();
if(GUI.FullScreen)
......@@ -1717,11 +1715,6 @@ LRESULT CALLBACK WinProc(
SwitchToGDI();
if (GUI.NextScale != old_scale)
{
UpdateScale((RenderFilter &)old_scale, GUI.NextScale);
}
GUI.ScaleHiRes = GUI.NextScaleHiRes;
RestoreSNESDisplay ();
S9xGraphicsDeinit();
......@@ -2324,7 +2317,7 @@ LRESULT CALLBACK WinProc(
case WM_EXITMENULOOP:
UpdateWindow(GUI.hWnd);
//UpdateBackBuffer();
DrawMenuBar(GUI.hWnd);
S9xClearPause (PAUSE_MENU);
break;
......@@ -2333,7 +2326,7 @@ LRESULT CALLBACK WinProc(
CheckMenuStates ();
SwitchToGDI();
DrawMenuBar( GUI.hWnd);
DrawMenuBar(GUI.hWnd);
break;
case WM_CLOSE: {
......@@ -2351,14 +2344,8 @@ LRESULT CALLBACK WinProc(
return (0);
case WM_PAINT:
{
PAINTSTRUCT paint;
BeginPaint (GUI.hWnd, &paint);
// refresh screen
WinRefreshDisplay();
EndPaint (GUI.hWnd, &paint);
break;
}
case WM_SYSCOMMAND:
......@@ -3446,7 +3433,7 @@ int WINAPI WinMain(
DispatchMessage (&msg);