This commit is contained in:
zilmar 2015-09-20 06:24:57 +10:00
commit ab59e1eb18
19 changed files with 258 additions and 115 deletions

View File

@ -3470,6 +3470,7 @@ Self Texture=1
Good Name=Mario Kart 64 (E) (V1.0)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A38 2409,81001A3A 0002,81001A3C 2409,81001A3E 0002,81001C90 240A,81001C92 0002,81001C94 240A,81001C96 0002 //Multiplayer timing fix
Plugin Note=[video] (see GameFAQ)
Culling=1
Primary Frame Buffer=1
@ -3478,6 +3479,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (E) (V1.1)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A38 2409,81001A3A 0002,81001A3C 2409,81001A3E 0002,81001C90 240A,81001C92 0002,81001C94 240A,81001C96 0002 //Multiplayer timing fix
Plugin Note=[video] (see GameFAQ)
Culling=1
Primary Frame Buffer=1
@ -3486,6 +3488,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (J) (V1.0)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A38 2409,81001A3A 0002,81001A3C 2409,81001A3E 0002,81001C90 240A,81001C92 0002,81001C94 240A,81001C96 0002 //Multiplayer timing fix
Plugin Note=[video] (see GameFAQ)
Culling=1
Primary Frame Buffer=1
@ -3494,6 +3497,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (J) (V1.1)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A38 2409,81001A3A 0002,81001A3C 2409,81001A3E 0002,81001C90 240A,81001C92 0002,81001C94 240A,81001C96 0002 //Multiplayer timing fix
Plugin Note=[video] (see GameFAQ)
Culling=1
Primary Frame Buffer=1
@ -3502,6 +3506,7 @@ Primary Frame Buffer=1
Good Name=Mario Kart 64 (U)
Internal Name=MARIOKART64
Status=Compatible
Cheat0=81001A38 2409,81001A3A 0002,81001A3C 2409,81001A3E 0002,81001C90 240A,81001C92 0002,81001C94 240A,81001C96 0002 //Multiplayer timing fix
Plugin Note=[video] (see GameFAQ)
Culling=1
Primary Frame Buffer=1

View File

@ -65,7 +65,11 @@ void EnterLogOptions(HWND hwndOwner)
psh.pfnCallback = NULL;
LoadLogOptions(&TempOptions,TRUE);
PropertySheet(&psh);
#if defined(WINDOWS_UI)
PropertySheet(&psh);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
SaveLogOptions();
LoadLogOptions(&LogOptions, FALSE);
return;

View File

@ -988,6 +988,7 @@ int CALLBACK CCheats::CheatListProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lP
Style = GetWindowLong((HWND)_this->m_hCheatTree,GWL_STYLE);
SetWindowLong((HWND)_this->m_hCheatTree,GWL_STYLE,TVS_CHECKBOXES |TVS_SHOWSELALWAYS| Style);
#if defined(WINDOWS_UI)
//Creats an image list from the bitmap in the resource section
HIMAGELIST hImageList;
HBITMAP hBmp;
@ -998,6 +999,9 @@ int CALLBACK CCheats::CheatListProc (HWND hDlg,DWORD uMsg,DWORD wParam, DWORD lP
DeleteObject(hBmp);
TreeView_SetImageList((HWND)_this->m_hCheatTree,hImageList,TVSIL_STATE);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
_this->m_hSelectedItem = NULL;

View File

@ -2364,7 +2364,10 @@ __inline void Float_RoundToInteger32( int * Dest, float * Source )
fistp dword ptr [edi]
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
__m128 xmm;
xmm = _mm_load_ss(Source);
*(Dest) = _mm_cvt_ss2si(xmm);
#endif
}
@ -2379,7 +2382,10 @@ __inline void Float_RoundToInteger64( __int64 * Dest, float * Source )
fistp qword ptr [edi]
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
__m128 xmm;
xmm = _mm_load_ss(Source);
*(Dest) = _mm_cvtss_si64(xmm);
#endif
}
@ -2413,12 +2419,12 @@ void R4300iOp::COP1_S_DIV()
void R4300iOp::COP1_S_SQRT()
{
float * Dest = (float *)(_FPR_S[m_Opcode.fd]);
float * Source = (float *)(_FPR_S[m_Opcode.fs]);
TEST_COP1_USABLE_EXCEPTION
_controlfp(*_RoundingModel,_MCW_RC);
#ifdef _M_IX86
float * Dest = (float *)_FPR_S[m_Opcode.fd];
float * Source = (float *)_FPR_S[m_Opcode.fs];
_asm
{
push esi
@ -2430,7 +2436,11 @@ void R4300iOp::COP1_S_SQRT()
pop esi
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
__m128 xmm;
xmm = _mm_load_ss(Source);
xmm = _mm_sqrt_ss(xmm);
*(Dest) = _mm_cvtss_f32(xmm);
#endif
}
@ -2586,7 +2596,10 @@ __inline void Double_RoundToInteger32( DWORD * Dest, double * Source )
fistp dword ptr [edi]
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
__m128d xmm;
xmm = _mm_load_sd(Source);
*(Dest) = _mm_cvtsd_si32(xmm);
#endif
}

View File

@ -70,25 +70,14 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
FlipBuffer[count] = 0xFF;
}
#ifdef _M_IX86
_asm
for (count = 0; (int)count < len; count += 4)
{
mov edi, dest
lea ecx, [FlipBuffer]
mov edx, 0
mov ebx, len
register DWORD eax;
memcpyloop:
mov eax, dword ptr [ecx + edx]
;bswap eax
mov dword ptr [edi + edx],eax
add edx, 4
cmp edx, ebx
jb memcpyloop
eax = *(unsigned __int32 *)&FlipBuffer[count];
// eax = swap32by8(eax); // ; bswap eax
*(unsigned __int32 *)(dest + count) = eax;
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
break;
case FLASHRAM_MODE_STATUS:
if (StartOffset != 0 && len != 8)
@ -198,28 +187,18 @@ void CFlashram::WriteToFlashCommand(DWORD FlashRAM_Command)
}
{
BYTE FlipBuffer[128];
memset(FlipBuffer,0,sizeof(FlipBuffer));
#ifdef _M_IX86
DWORD dwWritten;
register size_t edx;
BYTE * FlashRamPointer = m_FlashRamPointer;
_asm
{
lea edi, [FlipBuffer]
mov ecx, FlashRamPointer
mov edx, 0
memcpyloop:
mov eax, dword ptr [ecx + edx]
;bswap eax
mov dword ptr [edi + edx],eax
add edx, 4
cmp edx, 128
jb memcpyloop
memset(FlipBuffer,0,sizeof(FlipBuffer));
for (edx = 0; edx < 128; edx += 4)
{
register DWORD eax;
eax = *(unsigned __int32 *)&FlashRamPointer[edx];
// eax = swap32by8(eax); // ; bswap eax
*(unsigned __int32 *)(FlipBuffer + edx) = eax;
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
SetFilePointer(m_hFile,m_FlashRAM_Offset,NULL,FILE_BEGIN);
WriteFile(m_hFile,FlipBuffer,128,&dwWritten,NULL);

View File

@ -40,7 +40,7 @@ CMipsMemoryVM::CMipsMemoryVM( CMipsMemory_CallBack * CallBack, bool SavesReadOnl
m_IMEM = NULL;
}
static unsigned long swap32by8(unsigned long word)
unsigned long swap32by8(unsigned long word)
{
const unsigned long swapped =
#if defined(_MSC_VER)

View File

@ -10,6 +10,8 @@
****************************************************************************/
#pragma once
extern unsigned long swap32by8(unsigned long word);
class CMipsMemoryVM :
public CMipsMemory,
public CTransVaddr,

View File

@ -302,34 +302,14 @@ void CPifRam::SI_DMA_READ()
}
else
{
#ifdef _M_IX86
_asm
size_t i;
for (i = 0; i < 64; i += 4)
{
mov edi, dword ptr [SI_DRAM_ADDR_REG]
mov edi, dword ptr [edi]
add edi, RDRAM
mov ecx, PifRamPos
mov edx, 0
memcpyloop:
mov eax, dword ptr [ecx + edx]
bswap eax
mov dword ptr [edi + edx],eax
mov eax, dword ptr [ecx + edx + 4]
bswap eax
mov dword ptr [edi + edx + 4],eax
mov eax, dword ptr [ecx + edx + 8]
bswap eax
mov dword ptr [edi + edx + 8],eax
mov eax, dword ptr [ecx + edx + 12]
bswap eax
mov dword ptr [edi + edx + 12],eax
add edx, 16
cmp edx, 64
jb memcpyloop
*(unsigned __int32 *)&RDRAM[SI_DRAM_ADDR_REG + i] = swap32by8(
*(unsigned __int32 *)&PifRamPos[i]
);
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
}
if (LogOptions.LogPRDMAMemStores)
@ -413,34 +393,14 @@ void CPifRam::SI_DMA_WRITE()
}
else
{
#ifdef _M_IX86
_asm
size_t i;
for (i = 0; i < 64; i += 4)
{
mov ecx, dword ptr [SI_DRAM_ADDR_REG]
mov ecx, dword ptr [ecx]
add ecx, RDRAM
mov edi, PifRamPos
mov edx, 0
memcpyloop:
mov eax, dword ptr [ecx + edx]
bswap eax
mov dword ptr [edi + edx],eax
mov eax, dword ptr [ecx + edx + 4]
bswap eax
mov dword ptr [edi + edx + 4],eax
mov eax, dword ptr [ecx + edx + 8]
bswap eax
mov dword ptr [edi + edx + 8],eax
mov eax, dword ptr [ecx + edx + 12]
bswap eax
mov dword ptr [edi + edx + 12],eax
add edx, 16
cmp edx, 64
jb memcpyloop
*(unsigned __int32 *)&PifRamPos[i] = swap32by8(
*(unsigned __int32 *)&RDRAM[SI_DRAM_ADDR_REG + i]
);
}
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
}
if (LogOptions.LogPRDMAMemLoads)

View File

@ -308,11 +308,15 @@ void CN64System::StartEmulation2 ( bool NewThread )
{
g_Notify->DisplayMessage(5,L"Copy Plugins");
g_Plugins->CopyPlugins(g_Settings->LoadString(Directory_PluginSync));
#if defined(WINDOWS_UI)
m_SyncWindow = new CMainGui(false);
m_SyncPlugins = new CPlugins( g_Settings->LoadString(Directory_PluginSync) );
m_SyncPlugins->SetRenderWindows(m_SyncWindow,m_SyncWindow);
m_SyncCPU = new CN64System(m_SyncPlugins, true);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
if (CpuType == CPU_Recompiler || CpuType == CPU_SyncCores)
@ -563,7 +567,11 @@ void CN64System::Reset (bool bInitReg, bool ClearMenory)
RefreshGameSettings();
m_Audio.Reset();
m_MMU_VM.Reset(ClearMenory);
#if defined(WINDOWS_UI)
Debug_Reset();
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
Mempak::Close();
m_CyclesToSkip = 0;
@ -903,8 +911,11 @@ void CN64System::ExecuteCPU()
switch ((CPU_TYPE)g_Settings->LoadDword(Game_CpuType))
{
// Currently the compiler is 32-bit only. We might have to ignore that RDB setting for now.
#ifndef _WIN64
case CPU_Recompiler: ExecuteRecompiler(); break;
case CPU_SyncCores: ExecuteSyncCPU(); break;
#endif
default: ExecuteInterpret(); break;
}
g_Settings->SaveBool(GameRunning_CPU_Running,(DWORD)false);
@ -2066,5 +2077,9 @@ void CN64System::TLB_Unmaped ( DWORD VAddr, DWORD Len )
void CN64System::TLB_Changed()
{
#if defined(WINDOWS_UI)
Debug_RefreshTLBWindow();
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}

View File

@ -25,8 +25,12 @@ class CN64System :
private CSystemEvents,
protected CN64SystemSettings,
public CGameSettings,
#if defined(WINDOWS_UI)
protected CDebugSettings,
public CDebugger
#else
protected CDebugSettings
#endif
{
public:
CN64System ( CPlugins * Plugins, bool SavesReadOnly );

View File

@ -261,7 +261,12 @@ bool CPlugins::Initiate ( CN64System * System )
bool CPlugins::ResetInUiThread ( CN64System * System )
{
#if defined(WINDOWS_UI)
return m_RenderWindow->ResetPlugins(this, System);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
return false;
#endif
}
bool CPlugins::Reset ( CN64System * System )

View File

@ -118,7 +118,11 @@ void CNotification::DisplayMessage ( int DisplayTime, const wchar_t * Message,
}
else
{
#if defined(WINDOWS_UI)
m_hWnd->SetStatusText(0, Msg);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
}
@ -136,8 +140,12 @@ void CNotification::DisplayMessage2 ( const wchar_t * Message, va_list ap ) con
wchar_t Msg[1000];
_vsnwprintf( Msg,sizeof(Msg) - 1 ,Message, ap );
va_end( ap );
#if defined(WINDOWS_UI)
m_hWnd->SetStatusText(1,Msg);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
void CNotification::SetGfxPlugin( CGfxPlugin * Plugin )
@ -148,11 +156,15 @@ void CNotification::SetGfxPlugin( CGfxPlugin * Plugin )
void CNotification::SetWindowCaption (const wchar_t * Caption)
{
static const size_t TITLE_SIZE = 256;
wchar_t WinTitle[TITLE_SIZE];
_snwprintf(WinTitle, TITLE_SIZE, L"%s - %s", Caption, g_Settings->LoadString(Setting_ApplicationName).ToUTF16().c_str());
WinTitle[TITLE_SIZE - 1] = 0;
#if defined(WINDOWS_UI)
m_hWnd->Caption(WinTitle);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
void CNotification::FatalError ( const wchar_t * Message, ... ) const
@ -257,7 +269,12 @@ void CNotification::AddRecentRom ( const char * ImagePath )
void CNotification::RefreshMenu ( void )
{
if (m_hWnd == NULL) { return; }
#if defined(WINDOWS_UI)
m_hWnd->RefreshMenu();
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
void CNotification::HideRomBrowser ( void )
@ -280,13 +297,23 @@ void CNotification::ShowRomBrowser ( void )
void CNotification::BringToTop ( void )
{
if (m_hWnd == NULL) { return; }
#if defined(WINDOWS_UI)
m_hWnd->BringToTop();
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
void CNotification::MakeWindowOnTop ( bool OnTop )
{
if (m_hWnd == NULL) { return; }
#if defined(WINDOWS_UI)
m_hWnd->MakeWindowOnTop(OnTop);
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
#endif
}
void CNotification::ChangeFullScreen ( void ) const
@ -298,7 +325,13 @@ void CNotification::ChangeFullScreen ( void ) const
bool CNotification::ProcessGuiMessages ( void ) const
{
if (m_hWnd == NULL) { return false; }
#if defined(WINDOWS_UI)
return m_hWnd->ProcessGuiMessages();
#else
g_Notify -> BreakPoint(__FILEW__, __LINE__);
return false;
#endif
}
void CNotification::BreakPoint ( const wchar_t * FileName, const int LineNumber )

View File

@ -181,13 +181,16 @@ const char * AppName ( void )
#ifndef WINDOWS_UI
int main(int argc, char* argv[])
{
#error Cross-platform [graphical?] interface has not yet been implemented.
// Remove this #error to compile, but linking will fail with about 10 errors.
while (argc >= 0)
while (argc > 0)
{
puts(argv[--argc]);
}
putchar('\n');
fprintf(
stderr,
"Cross-platform (graphical/terminal?) UI not yet implemented.\n"
);
return 0;
}
#else

View File

@ -1228,10 +1228,11 @@ char * RSPOpcodeName ( DWORD OpCode, DWORD PC )
case RSP_SB:
case RSP_SH:
case RSP_SW:
sprintf(CommandName, "%s\t%s, 0x%04X(%s)",
sprintf(CommandName, "%s\t%s, %c0x%04X(%s)",
mnemonics_primary[command.op],
GPR_Name(command.rt),
command.offset,
((int16_t)command.offset < 0) ? '-' : '+',
abs((int16_t)command.offset),
GPR_Name(command.base)
);
break;

View File

@ -444,7 +444,9 @@ void Compile_ADDI ( void ) {
if (RSPOpC.rt == 0) return;
if (RSPOpC.rt == RSPOpC.rs) {
AddConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
if(Immediate != 0) {
AddConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
} else if (RSPOpC.rs == 0) {
MoveConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
} else if ((IsRegConst(RSPOpC.rs) & 1) != 0) {
@ -470,24 +472,52 @@ void Compile_ADDIU ( void ) {
if (RSPOpC.rt == 0) return;
if (RSPOpC.rt == RSPOpC.rs) {
AddConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
if(Immediate != 0) {
AddConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
} else if (RSPOpC.rs == 0) {
MoveConstToVariable(Immediate, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
} else {
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rs].UW, GPR_Name(RSPOpC.rs), x86_EAX);
AddConstToX86Reg(x86_EAX, Immediate);
if(Immediate != 0) {
AddConstToX86Reg(x86_EAX, Immediate);
}
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
}
void Compile_SLTI ( void ) {
#ifndef Compile_Immediates
Cheat_r4300iOpcode(RSP_Opcode_SLTI,"RSP_Opcode_SLTI");
#endif
int Immediate;
CPU_Message(" %X %s", CompilePC, RSPOpcodeName(RSPOpC.Hex, CompilePC));
if (RSPOpC.rt == 0) return;
Immediate = (short)RSPOpC.immediate;
XorX86RegToX86Reg(x86_ECX, x86_ECX);
CompConstToVariable(Immediate, &RSP_GPR[RSPOpC.rs].UW, GPR_Name(RSPOpC.rs));
Setl(x86_ECX);
MoveX86regToVariable(x86_ECX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
void Compile_SLTIU ( void ) {
#ifndef Compile_Immediates
Cheat_r4300iOpcode(RSP_Opcode_SLTIU,"RSP_Opcode_SLTIU");
#endif
int Immediate;
CPU_Message(" %X %s", CompilePC, RSPOpcodeName(RSPOpC.Hex, CompilePC));
if (RSPOpC.rt == 0) return;
Immediate = (short)RSPOpC.immediate;
XorX86RegToX86Reg(x86_ECX, x86_ECX);
CompConstToVariable(Immediate, &RSP_GPR[RSPOpC.rs].UW, GPR_Name(RSPOpC.rs));
Setb(x86_ECX);
MoveX86regToVariable(x86_ECX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
void Compile_ANDI ( void ) {
@ -590,6 +620,17 @@ void Compile_LB ( void ) {
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
if (IsRegConst(RSPOpC.base) == TRUE) {
char Address[32];
DWORD Addr = (MipsRegConst(RSPOpC.base) + Offset) ^ 3;
Addr &= 0xfff;
sprintf(Address, "Dmem + %Xh", Addr);
MoveSxVariableToX86regByte(RSPInfo.DMEM + Addr, Address, x86_EAX);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
return;
}
MoveVariableToX86reg(&RSP_GPR[RSPOpC.base].UW, GPR_Name(RSPOpC.base), x86_EBX);
if (Offset != 0) AddConstToX86Reg(x86_EBX, Offset);
XorConstToX86Reg(x86_EBX, 3);
@ -614,8 +655,15 @@ void Compile_LH ( void ) {
Addr &= 0xfff;
if ((Addr & 1) != 0) {
CompilerWarning("Unaligned LH at constant address PC = %04X", CompilePC);
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LH,"RSP_Opcode_LH");
if ((Addr & 2) == 0) {
CompilerWarning("Unaligned LH at constant address PC = %04X", CompilePC);
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LH,"RSP_Opcode_LH");
} else {
char Address[32];
sprintf(Address, "Dmem + %Xh", Addr);
MoveSxVariableToX86regHalf(RSPInfo.DMEM + (Addr ^ 2), Address, x86_EAX);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
} else {
char Address[32];
sprintf(Address, "Dmem + %Xh", Addr);
@ -667,9 +715,18 @@ void Compile_LW ( void ) {
if (IsRegConst(RSPOpC.base) == TRUE) {
DWORD Addr = (MipsRegConst(RSPOpC.base) + Offset) & 0xfff;
if ((Addr & 3) != 0) {
if ((Addr & 1) != 0) {
CompilerWarning("Unaligned LW at constant address PC = %04X", CompilePC);
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LW,"RSP_Opcode_LW");
} else if ((Addr & 2) != 0) {
char Address[32];
sprintf(Address, "Dmem + %Xh", Addr - 2);
MoveVariableToX86regHalf(RSPInfo.DMEM + Addr - 2, Address, x86_EAX);
sprintf(Address, "Dmem + %Xh", Addr);
MoveVariableToX86regHalf(RSPInfo.DMEM + Addr + 4, Address, x86_ECX);
MoveX86regHalfToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UHW[1], GPR_Name(RSPOpC.rt));
MoveX86regHalfToVariable(x86_ECX, &RSP_GPR[RSPOpC.rt].UHW[0], GPR_Name(RSPOpC.rt));
} else {
char Address[32];
sprintf(Address, "Dmem + %Xh", Addr);
@ -730,6 +787,17 @@ void Compile_LBU ( void ) {
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
if (IsRegConst(RSPOpC.base) == TRUE) {
char Address[32];
DWORD Addr = (MipsRegConst(RSPOpC.base) + Offset) ^ 3;
Addr &= 0xfff;
sprintf(Address, "Dmem + %Xh", Addr);
MoveZxVariableToX86regByte(RSPInfo.DMEM + Addr, Address, x86_EAX);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
return;
}
MoveVariableToX86reg(&RSP_GPR[RSPOpC.base].UW, GPR_Name(RSPOpC.base), x86_EBX);
XorX86RegToX86Reg(x86_EAX, x86_EAX);
@ -756,8 +824,15 @@ void Compile_LHU ( void ) {
Addr &= 0xfff;
if ((Addr & 1) != 0) {
CompilerWarning("Unaligned LHU at constant address PC = %04X", CompilePC);
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU,"RSP_Opcode_LHU");
if ((Addr & 2) == 0) {
CompilerWarning("Unaligned LHU at constant address PC = %04X", CompilePC);
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU, "RSP_Opcode_LHU");
} else {
char Address[32];
sprintf(Address, "Dmem + %Xh", Addr);
MoveZxVariableToX86regHalf(RSPInfo.DMEM + (Addr ^ 2), Address, x86_ECX);
MoveX86regToVariable(x86_ECX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
}
return;
} else {
char Address[32];

View File

@ -1824,6 +1824,25 @@ void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination) {
PUTDST8(RecompPos, Disp);
}
void MoveSxVariableToX86regByte(void *Variable, char *VariableName, int x86reg) {
CPU_Message(" movsx %s, byte ptr [%s]",x86_Name(x86reg),VariableName);
PUTDST16(RecompPos, 0xbe0f);
switch (x86reg) {
case x86_EAX: PUTDST8(RecompPos,0x05); break;
case x86_EBX: PUTDST8(RecompPos,0x1D); break;
case x86_ECX: PUTDST8(RecompPos,0x0D); break;
case x86_EDX: PUTDST8(RecompPos,0x15); break;
case x86_ESI: PUTDST8(RecompPos,0x35); break;
case x86_EDI: PUTDST8(RecompPos,0x3D); break;
case x86_ESP: PUTDST8(RecompPos,0x25); break;
case x86_EBP: PUTDST8(RecompPos,0x2D); break;
default: DisplayError("MoveSxVariableToX86regByte\nUnknown x86 Register");
}
PUTDST32(RecompPos,Variable);
}
void MoveSxVariableToX86regHalf(void *Variable, char *VariableName, int x86reg) {
CPU_Message(" movsx %s, word ptr [%s]",x86_Name(x86reg),VariableName);
@ -1963,6 +1982,25 @@ void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination) {
PUTDST8(RecompPos, Disp);
}
void MoveZxVariableToX86regByte(void *Variable, char *VariableName, int x86reg) {
CPU_Message(" movzx %s, byte ptr [%s]",x86_Name(x86reg),VariableName);
PUTDST16(RecompPos, 0xb60f);
switch (x86reg) {
case x86_EAX: PUTDST8(RecompPos,0x05); break;
case x86_EBX: PUTDST8(RecompPos,0x1D); break;
case x86_ECX: PUTDST8(RecompPos,0x0D); break;
case x86_EDX: PUTDST8(RecompPos,0x15); break;
case x86_ESI: PUTDST8(RecompPos,0x35); break;
case x86_EDI: PUTDST8(RecompPos,0x3D); break;
case x86_ESP: PUTDST8(RecompPos,0x25); break;
case x86_EBP: PUTDST8(RecompPos,0x2D); break;
default: DisplayError("MoveZxVariableToX86regByte\nUnknown x86 Register");
}
PUTDST32(RecompPos,Variable);
}
void MoveZxVariableToX86regHalf(void *Variable, char *VariableName, int x86reg) {
CPU_Message(" movzx %s, word ptr [%s]",x86_Name(x86reg),VariableName);

View File

@ -141,11 +141,13 @@ void MoveSxX86RegHalfToX86Reg ( int Source, int Destination );
void MoveSxX86RegPtrDispToX86RegHalf( int AddrReg, BYTE Disp, int Destination );
void MoveSxN64MemToX86regByte ( int x86reg, int AddrReg );
void MoveSxN64MemToX86regHalf ( int x86reg, int AddrReg );
void MoveSxVariableToX86regByte ( void *Variable, char *VariableName, int x86reg );
void MoveSxVariableToX86regHalf ( void *Variable, char *VariableName, int x86reg );
void MoveZxX86RegHalfToX86Reg ( int Source, int Destination );
void MoveZxX86RegPtrDispToX86RegHalf( int AddrReg, BYTE Disp, int Destination );
void MoveZxN64MemToX86regByte ( int x86reg, int AddrReg );
void MoveZxN64MemToX86regHalf ( int x86reg, int AddrReg );
void MoveZxVariableToX86regByte ( void *Variable, char *VariableName, int x86reg );
void MoveZxVariableToX86regHalf ( void *Variable, char *VariableName, int x86reg );
void MulX86reg ( int x86reg );
void NegateX86reg ( int x86reg );

View File

@ -39,7 +39,7 @@ SETLOCAL DisableDelayedExpansion
FOR /F "usebackq delims=" %%a in (`"findstr /n ^^ %version_file%"`) do (
set "line=%%a"
SETLOCAL EnableDelayedExpansion
set "line=!line:9999=%build_no%!"
set "line=!line:9999=%build_no%!"
set "line=!line:*:=!"
echo(!line!>>!out_file!
ENDLOCAL
@ -53,4 +53,4 @@ if exist "%out_file%" (
)
)
goto :eof
goto :eof

View File

@ -38,4 +38,4 @@ exit /B 1
:End
ENDLOCAL
exit /B 0
exit /B 0