Skip to content

Commit

Permalink
Update win32-dev branch to 1.52fix4
Browse files Browse the repository at this point in the history
  • Loading branch information
OV2 committed Sep 25, 2010
1 parent d166686 commit dec64a5
Show file tree
Hide file tree
Showing 17 changed files with 141 additions and 162 deletions.
33 changes: 22 additions & 11 deletions getset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -309,16 +310,18 @@ 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)
{
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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions win32/CDirect3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions win32/CDirectDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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];
Expand Down
25 changes: 8 additions & 17 deletions win32/CDirectSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ CDirectSound::CDirectSound()
bufferSize = 0;
blockSamples = 0;
hTimer = NULL;
hTimerQueue = NULL;
}

CDirectSound::~CDirectSound()
Expand Down Expand Up @@ -268,12 +267,6 @@ opened DirectSound in exclusive mode."),
}
}

hTimerQueue = CreateTimerQueue();
if(!hTimerQueue) {
DeInitDirectSound();
return false;
}

return (initDone);
}

Expand All @@ -292,10 +285,6 @@ void CDirectSound::DeInitDirectSound()
lpDS->Release ();
lpDS = NULL;
}
if(hTimerQueue) {
DeleteTimerQueueEx(hTimer,NULL);
hTimerQueue = NULL;
}
}

/* CDirectSound::InitSoundBuffer
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -460,6 +448,8 @@ void CDirectSound::MixSound()
HRESULT hResult;
DWORD curr_block;

if(!initDone)
return;

lpDSB->GetCurrentPosition (&play_pos, NULL);

Expand Down Expand Up @@ -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();
}

7 changes: 2 additions & 5 deletions win32/CDirectSound.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,15 @@ class CDirectSound : public IS9xSoundOutput
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();

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();
Expand Down
1 change: 1 addition & 0 deletions win32/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions win32/rsrc/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion win32/rsrc/snes9x.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions win32/snes9xw.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit dec64a5

Please sign in to comment.