Android: Get RSP core to compile on android

This commit is contained in:
zilmar 2023-11-09 11:53:06 +10:30
parent 09cc3442a2
commit 0c8b10bbc7
25 changed files with 324 additions and 259 deletions

2
.gitignore vendored
View File

@ -63,6 +63,8 @@ Thumbs.db
/Plugin/RSP/RSP_d 1.7.dll /Plugin/RSP/RSP_d 1.7.dll
/Plugin/RSP/RSP-HLE_d.dll /Plugin/RSP/RSP-HLE_d.dll
/Plugin/RSP/RSP-HLE.dll /Plugin/RSP/RSP-HLE.dll
/Plugin/RSP/Project64-RSP-Basic_d.dll
/Plugin/RSP/Project64-RSP-Basic.dll
/Plugin64/AndroidAudio /Plugin64/AndroidAudio
/Plugin64/Audio/AndroidAudio_d.dll /Plugin64/Audio/AndroidAudio_d.dll
/Plugin64/Audio/AndroidAudio.dll /Plugin64/Audio/AndroidAudio.dll

View File

@ -8,6 +8,7 @@ cd /d %origdir%
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Android\config\version.gradle.in" "%base_dir%\Android\config\version.gradle" "%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Android\config\version.gradle.in" "%base_dir%\Android\config\version.gradle"
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-core\Version.h.in" "%base_dir%\Source\Project64-core\Version.h" "%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-core\Version.h.in" "%base_dir%\Source\Project64-core\Version.h"
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-rsp-core\Version.h.in" "%base_dir%\Source\Project64-rsp-core\Version.h"
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-audio\Version.h.in" "%base_dir%\Source\Project64-audio\Version.h" "%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-audio\Version.h.in" "%base_dir%\Source\Project64-audio\Version.h"
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-video\Version.h.in" "%base_dir%\Source\Project64-video\Version.h" "%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\Project64-video\Version.h.in" "%base_dir%\Source\Project64-video\Version.h"
"%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\RSP\Version.h.in" "%base_dir%\Source\RSP\Version.h" "%base_dir%\Android\Script\UpdateVersion.exe" "%base_dir%\Source\RSP\Version.h.in" "%base_dir%\Source\RSP\Version.h"

View File

@ -39,9 +39,11 @@ dependencies {
implementation project(':jni:3rdParty:zlib') implementation project(':jni:3rdParty:zlib')
implementation project(':jni:Common') implementation project(':jni:Common')
implementation project(':jni:Settings') implementation project(':jni:Settings')
implementation project(':jni:Project64-rsp-core')
implementation project(':jni:Project64-core') implementation project(':jni:Project64-core')
implementation project(':jni:Project64-bridge') implementation project(':jni:Project64-bridge')
implementation project(':jni:Project64-video') implementation project(':jni:Project64-video')
implementation project(':jni:Project64-audio') implementation project(':jni:Project64-audio')
implementation project(':jni:Plugin-input') implementation project(':jni:Plugin-input')
implementation project(':jni:Plugin-rsp')
} }

View File

@ -2,13 +2,15 @@ cmake_minimum_required(VERSION 2.8.12)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
project("Project64-rsp") project("Plugin-rsp")
include_directories(..) include_directories(..)
add_library(Project64-rsp SHARED add_library(Plugin-rsp SHARED
main.cpp) main.cpp)
add_definitions(-DANDROID) add_definitions(-DANDROID)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Common ${CMAKE_CURRENT_BINARY_DIR}/Common)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Project64-rsp-core ${CMAKE_CURRENT_BINARY_DIR}/Project64-rsp-core)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Settings ${CMAKE_CURRENT_BINARY_DIR}/Settings) ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Settings ${CMAKE_CURRENT_BINARY_DIR}/Settings)
target_link_libraries(Project64-rsp settings) target_link_libraries(Plugin-rsp Project64-rsp-core settings Common)

View File

@ -20,5 +20,6 @@ add_definitions(-DANDROID)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/asmjit ${CMAKE_CURRENT_BINARY_DIR}/3rdParty/asmjit) ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/asmjit ${CMAKE_CURRENT_BINARY_DIR}/3rdParty/asmjit)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/zlib ${CMAKE_CURRENT_BINARY_DIR}/3rdParty/zlib) ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/zlib ${CMAKE_CURRENT_BINARY_DIR}/3rdParty/zlib)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Common ${CMAKE_CURRENT_BINARY_DIR}/Common) ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Common ${CMAKE_CURRENT_BINARY_DIR}/Common)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Project64-rsp-core ${CMAKE_CURRENT_BINARY_DIR}/Project64-rsp-core)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Project64-core ${CMAKE_CURRENT_BINARY_DIR}/Project64-core) ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Project64-core ${CMAKE_CURRENT_BINARY_DIR}/Project64-core)
target_link_libraries(Project64-bridge asmjit zlib Project64-core Common log) target_link_libraries(Project64-bridge asmjit zlib Project64-rsp-core Project64-core Common log)

View File

@ -106,8 +106,7 @@ add_library(Project64-core STATIC
Settings/SettingType/SettingsType-TempString.cpp Settings/SettingType/SettingsType-TempString.cpp
Settings/DebugSettings.cpp Settings/DebugSettings.cpp
Settings/GameSettings.cpp Settings/GameSettings.cpp
Settings/N64SystemSettings.cpp Settings/N64SystemSettings.cpp)
../Project64-rsp-core/cpu/RSPRegisterHandler.cpp)
add_definitions(-DANDROID) add_definitions(-DANDROID)

View File

@ -1,3 +1,5 @@
/.cxx
/build
*.c *.c
*.cpp *.cpp
*.h *.h

View File

@ -2,11 +2,43 @@ cmake_minimum_required(VERSION 2.8.12)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
project("Project64.rsp.core") project("Project64-rsp-core")
add_library(Project64.rsp.core STATIC add_library(Project64-rsp-core STATIC
Hle/alist.cpp) cpu/RspClamp.cpp
cpu/RSPCpu.cpp
cpu/RSPiInstruction.cpp
cpu/RSPInterpreterCPU.cpp
cpu/RSPInterpreterOps.cpp
cpu/RspLog.cpp
cpu/RspMemory.cpp
cpu/RSPRegister.cpp
cpu/RSPRegisterHandler.cpp
cpu/RSPRegisterHandlerPlugin.cpp
cpu/RspTypes.cpp
Hle/alist.cpp
Hle/alist_audio.cpp
Hle/alist_naudio.cpp
Hle/alist_nead.cpp
Hle/audio.cpp
Hle/cicx105.cpp
Hle/hle.cpp
Hle/jpeg.cpp
Hle/mem.cpp
Hle/mp3.cpp
Hle/musyx.cpp
Recompiler/Mmx.cpp
Recompiler/RspProfiling.cpp
Recompiler/RspRecompilerAnalysis.cpp
Recompiler/RspRecompilerCPU.cpp
Recompiler/RspRecompilerOps.cpp
Recompiler/RspRecompilerSections.cpp
Recompiler/Sse.cpp
Recompiler/X86.cpp
Settings/RspSettings.cpp
RSPDebugger.cpp
RSPInfo.cpp)
add_definitions(-DANDROID) add_definitions(-DANDROID)
target_link_libraries(Project64.rsp.core) target_link_libraries(Project64-rsp-core)

View File

@ -1,2 +1,2 @@
rootProject.name = 'Project64' rootProject.name = 'Project64'
include ':app', ':jni:3rdParty:asmjit', ':jni:3rdParty:png', ':jni:3rdParty:zlib', ':jni:Common', ':jni:Settings', ':jni:Project64-core', ':jni:Project64-bridge', ':jni:Project64-video', ':jni:Project64-audio', ':jni:Plugin-input' include ':app', ':jni:3rdParty:asmjit', ':jni:3rdParty:png', ':jni:3rdParty:zlib', ':jni:Common', ':jni:Settings', ':jni:Project64-rsp-core', ':jni:Project64-core', ':jni:Project64-bridge', ':jni:Project64-video', ':jni:Project64-audio', ':jni:Plugin-input', ':jni:Plugin-rsp'

View File

@ -1,15 +1,19 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#if !defined(_WIN32) && !defined(__interface)
#define __interface struct
#endif
__interface RSPDebugger __interface RSPDebugger
{ {
void ResetTimerList(void) = 0; virtual void ResetTimerList(void) = 0;
void StartingCPU(void) = 0; virtual void StartingCPU(void) = 0;
void RspCyclesStart(void) = 0; virtual void RspCyclesStart(void) = 0;
void RspCyclesStop(void) = 0; virtual void RspCyclesStop(void) = 0;
void BeforeExecuteOp(void) = 0; virtual void BeforeExecuteOp(void) = 0;
void UnknownOpcode(void) = 0; virtual void UnknownOpcode(void) = 0;
void RDP_LogMF0(uint32_t PC, uint32_t Reg) = 0; virtual void RDP_LogMF0(uint32_t PC, uint32_t Reg) = 0;
}; };
extern RSPDebugger * g_RSPDebugger; extern RSPDebugger * g_RSPDebugger;

View File

@ -1,4 +1,4 @@
#include "x86.h" #include "X86.h"
#include <Project64-rsp-core/cpu/RSPRegisters.h> #include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspLog.h> #include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h> #include <Project64-rsp-core/cpu/RspMemory.h>
@ -60,7 +60,7 @@ void MmxMoveRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxMoveQwordVariableToReg(int Dest, void * Variable, char * VariableName) void MmxMoveQwordVariableToReg(int Dest, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -83,7 +83,7 @@ void MmxMoveQwordVariableToReg(int Dest, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MmxMoveQwordRegToVariable(int Dest, void * Variable, char * VariableName) void MmxMoveQwordRegToVariable(int Dest, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -138,7 +138,7 @@ void MmxPorRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxPorVariableToReg(void * Variable, char * VariableName, int Dest) void MmxPorVariableToReg(void * Variable, const char * VariableName, int Dest)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -193,7 +193,7 @@ void MmxPandRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxPandVariableToReg(void * Variable, char * VariableName, int Dest) void MmxPandVariableToReg(void * Variable, const char * VariableName, int Dest)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -280,7 +280,7 @@ void MmxXorRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, uint8_t Immed) void MmxShuffleMemoryToReg(int Dest, void * Variable, const char * VariableName, uint8_t Immed)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -368,7 +368,7 @@ void MmxPmullwRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxPmullwVariableToReg(int Dest, void * Variable, char * VariableName) void MmxPmullwVariableToReg(int Dest, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -454,7 +454,7 @@ void MmxPmulhwRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxPmulhwRegToVariable(int Dest, void * Variable, char * VariableName) void MmxPmulhwRegToVariable(int Dest, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -609,7 +609,7 @@ void MmxPsubswRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, 0xC0 | x86Command);
} }
void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName) void MmxPaddswVariableToReg(int Dest, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -632,7 +632,7 @@ void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MmxPsubswVariableToReg(int Dest, void * Variable, char * VariableName) void MmxPsubswVariableToReg(int Dest, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;

View File

@ -5,12 +5,13 @@
#include <Common/File.h> #include <Common/File.h>
#include <Common/Log.h> #include <Common/Log.h>
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Settings/Settings.h>
#include <map> #include <map>
#include <vector> #include <vector>
class CRspProfiling class CRspProfiling
{ {
typedef std::map<uint32_t, __int64> PROFILE_ENRTIES; typedef std::map<uint32_t, int64_t> PROFILE_ENRTIES;
typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY; typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY;
typedef PROFILE_ENRTIES::value_type PROFILE_VALUE; typedef PROFILE_ENRTIES::value_type PROFILE_VALUE;
typedef struct typedef struct
@ -47,7 +48,7 @@ public:
m_StartTimeHi = HiValue; m_StartTimeHi = HiValue;
m_StartTimeLo = LoValue; m_StartTimeLo = LoValue;
#else #else
__debugbreak(); g_Notify->BreakPoint(__FILE__, __LINE__);
#endif #endif
return OldTimerAddr; return OldTimerAddr;
} }
@ -68,9 +69,9 @@ public:
popad popad
} }
__int64 StopTime = ((unsigned __int64)HiValue << 32) + (unsigned __int64)LoValue; int64_t StopTime = ((uint64_t)HiValue << 32) + (uint64_t)LoValue;
__int64 StartTime = ((unsigned __int64)m_StartTimeHi << 32) + (unsigned __int64)m_StartTimeLo; int64_t StartTime = ((uint64_t)m_StartTimeHi << 32) + (uint64_t)m_StartTimeLo;
__int64 TimeTaken = StopTime - StartTime; int64_t TimeTaken = StopTime - StartTime;
PROFILE_ENRTY Entry = m_Entries.find(m_CurrentTimerAddr); PROFILE_ENRTY Entry = m_Entries.find(m_CurrentTimerAddr);
if (Entry != m_Entries.end()) if (Entry != m_Entries.end())
@ -82,7 +83,7 @@ public:
m_Entries.insert(PROFILE_ENRTIES::value_type(m_CurrentTimerAddr, TimeTaken)); m_Entries.insert(PROFILE_ENRTIES::value_type(m_CurrentTimerAddr, TimeTaken));
} }
#else #else
__debugbreak(); g_Notify->BreakPoint(__FILE__, __LINE__);
#endif #endif
uint32_t OldTimerAddr = m_CurrentTimerAddr; uint32_t OldTimerAddr = m_CurrentTimerAddr;
@ -106,7 +107,7 @@ public:
LogFileName = Log.FileName(); LogFileName = Log.FileName();
// Get the total time // Get the total time
__int64 TotalTime = 0; int64_t TotalTime = 0;
for (PROFILE_ENRTY itemTime = m_Entries.begin(); itemTime != m_Entries.end(); itemTime++) for (PROFILE_ENRTY itemTime = m_Entries.begin(); itemTime != m_Entries.end(); itemTime++)
{ {
TotalTime += itemTime->second; TotalTime += itemTime->second;

View File

@ -1,7 +1,7 @@
#include "RspRecompilerCPU.h" #include "RspRecompilerCPU.h"
#include "RspProfiling.h" #include "RspProfiling.h"
#include "RspRecompilerOps.h" #include "RspRecompilerOps.h"
#include "x86.h" #include "X86.h"
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h> #include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPCpu.h> #include <Project64-rsp-core/cpu/RSPCpu.h>
@ -791,7 +791,7 @@ void CompilerRSPBlock(void)
// Align the block to a boundary // Align the block to a boundary
if (X86BaseAddress & 7) if (X86BaseAddress & 7)
{ {
register size_t Count; size_t Count;
const size_t Padding = (8 - (X86BaseAddress & 7)) & 7; const size_t Padding = (8 - (X86BaseAddress & 7)) & 7;
for (Count = 0; Count < Padding; Count++) for (Count = 0; Count < Padding; Count++)
@ -864,7 +864,7 @@ void CompilerRSPBlock(void)
char str[40]; char str[40];
sprintf(str, "%X", CompilePC); sprintf(str, "%X", CompilePC);
PushImm32(str, CompilePC); PushImm32(str, CompilePC);
Call_Direct(RDP_LogLoc, "RDP_LogLoc"); Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
} }
@ -1003,7 +1003,7 @@ uint32_t RunRecompilerCPU(uint32_t Cycles)
popad popad
} }
#else #else
__debugbreak(); g_Notify->BreakPoint(__FILE__, __LINE__);
#endif #endif
if (Profiling && IndvidualBlock) if (Profiling && IndvidualBlock)
{ {
@ -1020,7 +1020,7 @@ uint32_t RunRecompilerCPU(uint32_t Cycles)
#if defined(_M_IX86) && defined(_MSC_VER) #if defined(_M_IX86) && defined(_MSC_VER)
_asm emms _asm emms
#else #else
__debugbreak(); g_Notify->BreakPoint(__FILE__, __LINE__);
#endif #endif
} }
return Cycles; return Cycles;

View File

@ -1,7 +1,7 @@
#include "Project64-rsp-core/Recompiler/RspRecompilerCPU.h" #include "Project64-rsp-core/Recompiler/RspRecompilerCPU.h"
#include "RspProfiling.h" #include "RspProfiling.h"
#include "RspRecompilerCPU.h" #include "RspRecompilerCPU.h"
#include "x86.h" #include "X86.h"
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h> #include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPCpu.h> #include <Project64-rsp-core/cpu/RSPCpu.h>
@ -112,17 +112,17 @@ void Branch_AddRef(uint32_t Target, uint32_t * X86Loc)
} }
} }
void Cheat_r4300iOpcode(p_func FunctAddress, char * FunctName) void Cheat_r4300iOpcode(p_func FunctAddress, const char * FunctName)
{ {
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str()); CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value"); MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value");
Call_Direct(FunctAddress, FunctName); Call_Direct((void *)FunctAddress, FunctName);
} }
void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, char * FunctName) void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, const char * FunctName)
{ {
MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value"); MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value");
Call_Direct(FunctAddress, FunctName); Call_Direct((void *)FunctAddress, FunctName);
} }
void x86_SetBranch8b(void * JumpByte, void * Destination) void x86_SetBranch8b(void * JumpByte, void * Destination)
@ -225,7 +225,7 @@ void Compile_JAL(void)
sprintf(Str, "%03X", (RSPOpC.target << 2) & 0xFFC); sprintf(Str, "%03X", (RSPOpC.target << 2) & 0xFFC);
Push(x86_EAX); Push(x86_EAX);
PushImm32(Str, *PrgCount); PushImm32(Str, *PrgCount);
Call_Direct(StartTimer, "StartTimer"); Call_Direct((void *)StartTimer, "StartTimer");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
Pop(x86_EAX); Pop(x86_EAX);
} }
@ -1450,7 +1450,7 @@ void Compile_Special_JR(void)
{ {
Push(x86_EAX); Push(x86_EAX);
Push(x86_EAX); Push(x86_EAX);
Call_Direct(StartTimer, "StartTimer"); Call_Direct((void *)StartTimer, "StartTimer");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
Pop(x86_EAX); Pop(x86_EAX);
} }
@ -1464,7 +1464,7 @@ void Compile_Special_JR(void)
// Before we branch quickly update our stats // Before we branch quickly update our stats
/*if (CompilePC == 0x080) { /*if (CompilePC == 0x080) {
Pushad(); Pushad();
Call_Direct(UpdateAudioTimer, "UpdateAudioTimer"); Call_Direct((void *)UpdateAudioTimer, "UpdateAudioTimer");
Popad(); Popad();
}*/ }*/
JumpX86Reg(x86_EAX); JumpX86Reg(x86_EAX);
@ -2083,7 +2083,7 @@ void Compile_Cop0_MF(void)
PushImm32(str, RSPOpC.rd); PushImm32(str, RSPOpC.rd);
sprintf(str, "%X", CompilePC); sprintf(str, "%X", CompilePC);
PushImm32(str, CompilePC); PushImm32(str, CompilePC);
Call_Direct(RDP_LogMF0, "RDP_LogMF0"); Call_Direct((void *)RDP_LogMF0, "RDP_LogMF0");
AddConstToX86Reg(x86_ESP, 8); AddConstToX86Reg(x86_ESP, 8);
} }
@ -2105,7 +2105,7 @@ void Compile_Cop0_MF(void)
BreakPoint(); BreakPoint();
} }
return; return;
#else #elif defined(_M_IX86) && defined(_MSC_VER)
switch (RSPOpC.rd) switch (RSPOpC.rd)
{ {
case 0: case 0:
@ -2186,6 +2186,8 @@ void Compile_Cop0_MF(void)
default: default:
g_Notify->DisplayError(stdstr_f("We have not implemented RSP MF CP0 reg %s (%d)", COP0_Name(RSPOpC.rd), RSPOpC.rd).c_str()); g_Notify->DisplayError(stdstr_f("We have not implemented RSP MF CP0 reg %s (%d)", COP0_Name(RSPOpC.rd), RSPOpC.rd).c_str());
} }
#else
g_Notify->BreakPoint(__FILE__, __LINE__);
#endif #endif
} }
@ -2203,7 +2205,7 @@ void Compile_Cop0_MT(void)
PushImm32(str, RSPOpC.rd); PushImm32(str, RSPOpC.rd);
sprintf(str, "%X", CompilePC); sprintf(str, "%X", CompilePC);
PushImm32(str, CompilePC); PushImm32(str, CompilePC);
Call_Direct(RDP_LogMT0, "RDP_LogMT0"); Call_Direct((void *)RDP_LogMT0, "RDP_LogMT0");
AddConstToX86Reg(x86_ESP, 12); AddConstToX86Reg(x86_ESP, 12);
} }
@ -2227,7 +2229,7 @@ void Compile_Cop0_MT(void)
BreakPoint(); BreakPoint();
} }
} }
#else #elif defined(_M_IX86) && defined(_MSC_VER)
switch (RSPOpC.rd) switch (RSPOpC.rd)
{ {
case 0: case 0:
@ -2294,7 +2296,7 @@ void Compile_Cop0_MT(void)
if (LogRDP) if (LogRDP)
{ {
Call_Direct(RDP_LogDlist, "RDP_LogDlist"); Call_Direct((void *)RDP_LogDlist, "RDP_LogDlist");
} }
if (RSPInfo.ProcessRdpList != NULL) if (RSPInfo.ProcessRdpList != NULL)
@ -2302,14 +2304,14 @@ void Compile_Cop0_MT(void)
if (Profiling) if (Profiling)
{ {
PushImm32("Timer_RDP_Running", (uint32_t)Timer_RDP_Running); PushImm32("Timer_RDP_Running", (uint32_t)Timer_RDP_Running);
Call_Direct(StartTimer, "StartTimer"); Call_Direct((void *)StartTimer, "StartTimer");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
Push(x86_EAX); Push(x86_EAX);
} }
Call_Direct(RSPInfo.ProcessRdpList, "ProcessRdpList"); Call_Direct((void *)RSPInfo.ProcessRdpList, "ProcessRdpList");
if (Profiling) if (Profiling)
{ {
Call_Direct(StartTimer, "StartTimer"); Call_Direct((void *)StartTimer, "StartTimer");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
} }
} }
@ -2324,6 +2326,8 @@ void Compile_Cop0_MT(void)
Cheat_r4300iOpcode(RSP_Cop0_MT, "RSP_Cop0_MT"); Cheat_r4300iOpcode(RSP_Cop0_MT, "RSP_Cop0_MT");
break; break;
} }
#else
g_Notify->BreakPoint(__FILE__, __LINE__);
#endif #endif
if (RSPOpC.rd == 2 && !ChangedPC) if (RSPOpC.rd == 2 && !ChangedPC)
{ {
@ -4875,7 +4879,7 @@ void Compile_Vector_VGE(void)
{ /* { /*
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC); bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
/* TODO: works ok, but needs careful flag analysis */ TODO: works ok, but needs careful flag analysis */
/* #if defined (DLIST) /* #if defined (DLIST)
if (bWriteToAccum == false && true == Compile_Vector_VGE_MMX()) { if (bWriteToAccum == false && true == Compile_Vector_VGE_MMX()) {
return; return;
@ -7178,6 +7182,6 @@ void Compile_UnknownOpcode(void)
NextInstruction = RSPPIPELINE_FINISH_BLOCK; NextInstruction = RSPPIPELINE_FINISH_BLOCK;
MoveConstToVariable(CompilePC, PrgCount, "RSP PC"); MoveConstToVariable(CompilePC, PrgCount, "RSP PC");
MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value"); MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value");
Call_Direct(rsp_UnknownOpcode, "rsp_UnknownOpcode"); Call_Direct((void *)rsp_UnknownOpcode, "rsp_UnknownOpcode");
Ret(); Ret();
} }

View File

@ -1,5 +1,5 @@
#include "RspRecompilerCPU.h" #include "RspRecompilerCPU.h"
#include "x86.h" #include "X86.h"
#include <Project64-rsp-core/cpu/RSPCpu.h> #include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h> #include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h> #include <Project64-rsp-core/cpu/RSPRegisters.h>
@ -892,7 +892,7 @@ void Compile_Section_000(void)
char str[40]; char str[40];
sprintf(str, "%X", CompilePC); sprintf(str, "%X", CompilePC);
PushImm32(str, CompilePC); PushImm32(str, CompilePC);
Call_Direct(RDP_LogLoc, "RDP_LogLoc"); Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
} }
@ -906,7 +906,7 @@ void Compile_Section_000(void)
char str[40]; char str[40];
sprintf(str, "%X", CompilePC + 0x04 + (i * 4)); sprintf(str, "%X", CompilePC + 0x04 + (i * 4));
PushImm32(str, CompilePC + 0x04 + (i * 4)); PushImm32(str, CompilePC + 0x04 + (i * 4));
Call_Direct(RDP_LogLoc, "RDP_LogLoc"); Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
} }
} }
@ -1129,7 +1129,7 @@ void Compile_Section_002(void)
char str[40]; char str[40];
sprintf(str, "%X", CompilePC + (Count * 0x04)); sprintf(str, "%X", CompilePC + (Count * 0x04));
PushImm32(str, CompilePC + (Count * 0x04)); PushImm32(str, CompilePC + (Count * 0x04));
Call_Direct(RDP_LogLoc, "RDP_LogLoc"); Call_Direct((void *)RDP_LogLoc, "RDP_LogLoc");
AddConstToX86Reg(x86_ESP, 4); AddConstToX86Reg(x86_ESP, 4);
} }
} }
@ -1192,10 +1192,10 @@ static void resampler_hle()
{ {
UDWORD accum, initial; UDWORD accum, initial;
uint32_t const2 = (uint32_t)RSP_Vect[18].u16(4 ^ 7); uint32_t const2 = (uint32_t)RSP_Vect[18].u16(4 ^ 7);
__int64 const3 = (__int64)((int)RSP_Vect[30].s16(0 ^ 7)) << 16; int64_t const3 = (int64_t)((int)RSP_Vect[30].s16(0 ^ 7)) << 16;
// VMUDM $v23, $v31, $v23 [7] // VMUDM $v23, $v31, $v23 [7]
initial.DW = (__int64)((uint32_t)RSP_Vect[23].u16(7 ^ 7)) << 16; initial.DW = (int64_t)((uint32_t)RSP_Vect[23].u16(7 ^ 7)) << 16;
// VMADH $v23, $v31, $v22 [7] // VMADH $v23, $v31, $v22 [7]
initial.W[1] += (int)RSP_Vect[22].s16(7 ^ 7); initial.W[1] += (int)RSP_Vect[22].s16(7 ^ 7);
@ -1204,7 +1204,7 @@ static void resampler_hle()
accum.DW = initial.DW; accum.DW = initial.DW;
// VMADM $v22, $v25, $v18 [4] // VMADM $v22, $v25, $v18 [4]
accum.DW += (__int64)((int)RSP_Vect[25].s16(i) * const2) << 16; accum.DW += (int64_t)((int)RSP_Vect[25].s16(i) * const2) << 16;
if (accum.W[1] > 0x7FFF) if (accum.W[1] > 0x7FFF)
{ {
RSP_Vect[22].s16(i) = 0x7FFF; RSP_Vect[22].s16(i) = 0x7FFF;
@ -1238,7 +1238,7 @@ static void resampler_hle()
void Compile_Section_003(void) void Compile_Section_003(void)
{ {
CPU_Message("Compiling: %X to ..., RSP optimization $003", CompilePC); CPU_Message("Compiling: %X to ..., RSP optimization $003", CompilePC);
Call_Direct(resampler_hle, "Resampler_HLE"); Call_Direct((void *)resampler_hle, "Resampler_HLE");
CompilePC += 4 * sizeof(RSPOpcode); CompilePC += 4 * sizeof(RSPOpcode);
} }

View File

@ -1,4 +1,4 @@
#include "x86.h" #include "X86.h"
#include <Project64-rsp-core/RSPInfo.h> #include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h> #include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspLog.h> #include <Project64-rsp-core/cpu/RspLog.h>
@ -30,7 +30,7 @@ char * sse_Strings[8] = {
#define sse_Name(Reg) (sse_Strings[(Reg)]) #define sse_Name(Reg) (sse_Strings[(Reg)])
void SseMoveAlignedVariableToReg(void * Variable, char * VariableName, int sseReg) void SseMoveAlignedVariableToReg(void * Variable, const char * VariableName, int sseReg)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -87,7 +87,7 @@ void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg)
PUTDSTPTR(RecompPos, RSPInfo.DMEM); PUTDSTPTR(RecompPos, RSPInfo.DMEM);
} }
void SseMoveAlignedRegToVariable(int sseReg, void * Variable, char * VariableName) void SseMoveAlignedRegToVariable(int sseReg, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -144,7 +144,7 @@ void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg)
PUTDSTPTR(RecompPos, RSPInfo.DMEM); PUTDSTPTR(RecompPos, RSPInfo.DMEM);
} }
void SseMoveUnalignedVariableToReg(void * Variable, char * VariableName, int sseReg) void SseMoveUnalignedVariableToReg(void * Variable, const char * VariableName, int sseReg)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;
@ -201,7 +201,7 @@ void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg)
PUTDSTPTR(RecompPos, RSPInfo.DMEM); PUTDSTPTR(RecompPos, RSPInfo.DMEM);
} }
void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, char * VariableName) void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, const char * VariableName)
{ {
uint8_t x86Command = 0; uint8_t x86Command = 0;

View File

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include "x86.h" #include "X86.h"
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h> #include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h> #include <Project64-rsp-core/cpu/RSPRegisters.h>
@ -24,15 +24,15 @@
*(void **)(dest) = (void *)(value); \ *(void **)(dest) = (void *)(value); \
dest += sizeof(void *); dest += sizeof(void *);
char * x86_Strings[8] = { const char * x86_Strings[8] = {
"eax", "ebx", "ecx", "edx", "eax", "ebx", "ecx", "edx",
"esi", "edi", "ebp", "esp"}; "esi", "edi", "ebp", "esp"};
char * x86_ByteStrings[8] = { const char * x86_ByteStrings[8] = {
"al", "bl", "cl", "dl", "al", "bl", "cl", "dl",
"?4", "?5", "?6", "?7"}; "?4", "?5", "?6", "?7"};
char * x86_HalfStrings[8] = { const char * x86_HalfStrings[8] = {
"ax", "bx", "cx", "dx", "ax", "bx", "cx", "dx",
"si", "di", "bp", "sp"}; "si", "di", "bp", "sp"};
@ -71,7 +71,7 @@ void AdcX86RegToX86Reg(int Destination, int Source)
PUTDST16(RecompPos, x86Command); PUTDST16(RecompPos, x86Command);
} }
void AdcX86regToVariable(int x86reg, void * Variable, char * VariableName) void AdcX86regToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" adc dword ptr [%s], %s", VariableName, x86_Name(x86reg)); CPU_Message(" adc dword ptr [%s], %s", VariableName, x86_Name(x86reg));
switch (x86reg) switch (x86reg)
@ -90,7 +90,7 @@ void AdcX86regToVariable(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName) void AdcX86regHalfToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" adc word ptr [%s], %s", VariableName, x86Half_Name(x86reg)); CPU_Message(" adc word ptr [%s], %s", VariableName, x86Half_Name(x86reg));
@ -111,7 +111,7 @@ void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void AdcConstToVariable(void * Variable, char * VariableName, uint8_t Constant) void AdcConstToVariable(void * Variable, const char * VariableName, uint8_t Constant)
{ {
CPU_Message(" adc dword ptr [%s], %Xh", VariableName, Constant); CPU_Message(" adc dword ptr [%s], %Xh", VariableName, Constant);
PUTDST16(RecompPos, 0x1583); PUTDST16(RecompPos, 0x1583);
@ -138,7 +138,7 @@ void AdcConstToX86reg(uint8_t Constant, int x86reg)
PUTDST8(RecompPos, Constant); PUTDST8(RecompPos, Constant);
} }
void AddConstToVariable(uint32_t Const, void * Variable, char * VariableName) void AddConstToVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" add dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" add dword ptr [%s], 0x%X", VariableName, Const);
PUTDST16(RecompPos, 0x0581); PUTDST16(RecompPos, 0x0581);
@ -186,7 +186,7 @@ void AddConstToX86Reg(int x86Reg, size_t Const)
} }
} }
void AdcConstHalfToVariable(void * Variable, char * VariableName, uint8_t Constant) void AdcConstHalfToVariable(void * Variable, const char * VariableName, uint8_t Constant)
{ {
CPU_Message(" adc word ptr [%s], %Xh", VariableName, Constant); CPU_Message(" adc word ptr [%s], %Xh", VariableName, Constant);
@ -199,7 +199,7 @@ void AdcConstHalfToVariable(void * Variable, char * VariableName, uint8_t Consta
PUTDST8(RecompPos, Constant); PUTDST8(RecompPos, Constant);
} }
void AddVariableToX86reg(int x86reg, void * Variable, char * VariableName) void AddVariableToX86reg(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" add %s, dword ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" add %s, dword ptr [%s]", x86_Name(x86reg), VariableName);
switch (x86reg) switch (x86reg)
@ -218,7 +218,7 @@ void AddVariableToX86reg(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void AddX86regToVariable(int x86reg, void * Variable, char * VariableName) void AddX86regToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" add dword ptr [%s], %s", VariableName, x86_Name(x86reg)); CPU_Message(" add dword ptr [%s], %s", VariableName, x86_Name(x86reg));
switch (x86reg) switch (x86reg)
@ -237,7 +237,7 @@ void AddX86regToVariable(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void AddX86regHalfToVariable(int x86reg, void * Variable, char * VariableName) void AddX86regHalfToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" add word ptr [%s], %s", VariableName, x86Half_Name(x86reg)); CPU_Message(" add word ptr [%s], %s", VariableName, x86Half_Name(x86reg));
@ -289,7 +289,7 @@ void AddX86RegToX86Reg(int Destination, int Source)
PUTDST16(RecompPos, x86Command); PUTDST16(RecompPos, x86Command);
} }
void AndConstToVariable(uint32_t Const, void * Variable, char * VariableName) void AndConstToVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" and dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" and dword ptr [%s], 0x%X", VariableName, Const);
PUTDST16(RecompPos, 0x2581); PUTDST16(RecompPos, 0x2581);
@ -332,7 +332,7 @@ void AndConstToX86Reg(int x86Reg, uint32_t Const)
} }
} }
void AndVariableToX86Reg(void * Variable, char * VariableName, int x86Reg) void AndVariableToX86Reg(void * Variable, const char * VariableName, int x86Reg)
{ {
CPU_Message(" and %s, dword ptr [%s]", x86_Name(x86Reg), VariableName); CPU_Message(" and %s, dword ptr [%s]", x86_Name(x86Reg), VariableName);
switch (x86Reg) switch (x86Reg)
@ -349,7 +349,7 @@ void AndVariableToX86Reg(void * Variable, char * VariableName, int x86Reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void AndVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg) void AndVariableToX86regHalf(void * Variable, const char * VariableName, int x86Reg)
{ {
CPU_Message(" and %s, word ptr [%s]", x86Half_Name(x86Reg), VariableName); CPU_Message(" and %s, word ptr [%s]", x86Half_Name(x86Reg), VariableName);
PUTDST8(RecompPos, 0x66); PUTDST8(RecompPos, 0x66);
@ -367,7 +367,7 @@ void AndVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void AndX86RegToVariable(void * Variable, char * VariableName, int x86Reg) void AndX86RegToVariable(void * Variable, const char * VariableName, int x86Reg)
{ {
CPU_Message(" and dword ptr [%s], %s", VariableName, x86_Name(x86Reg)); CPU_Message(" and dword ptr [%s], %s", VariableName, x86_Name(x86Reg));
switch (x86Reg) switch (x86Reg)
@ -460,7 +460,7 @@ void X86BreakPoint(const char * FileName, int LineNumber)
#else #else
g_Notify->DisplayError("PushImm64\nUnimplemented."); g_Notify->DisplayError("PushImm64\nUnimplemented.");
#endif #endif
Call_Direct(BreakPointNotification, "BreakPointNotification"); Call_Direct((void *)BreakPointNotification, "BreakPointNotification");
AddConstToX86Reg(x86_ESP, 8); AddConstToX86Reg(x86_ESP, 8);
Popad(); Popad();
CPU_Message(" int 3"); CPU_Message(" int 3");
@ -500,14 +500,14 @@ void BsrX86RegToX86Reg(int Destination, int Source)
PUTDST8(RecompPos, x86Command); PUTDST8(RecompPos, x86Command);
} }
void Call_Direct(void * FunctAddress, char * FunctName) void Call_Direct(void * FunctAddress, const char * FunctName)
{ {
CPU_Message(" call offset %s", FunctName); CPU_Message(" call offset %s", FunctName);
PUTDST8(RecompPos, 0xE8); PUTDST8(RecompPos, 0xE8);
PUTDSTPTR(RecompPos, (size_t)FunctAddress - (size_t)RecompPos - sizeof(void *)); PUTDSTPTR(RecompPos, (size_t)FunctAddress - (size_t)RecompPos - sizeof(void *));
} }
void Call_Indirect(void * FunctAddress, char * FunctName) void Call_Indirect(void * FunctAddress, const char * FunctName)
{ {
CPU_Message(" call [%s]", FunctName); CPU_Message(" call [%s]", FunctName);
PUTDST16(RecompPos, 0x15FF); PUTDST16(RecompPos, 0x15FF);
@ -802,7 +802,7 @@ void CondMoveLessEqual(int Destination, int Source)
} }
} }
void CompConstToVariable(uint32_t Const, void * Variable, char * VariableName) void CompConstToVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" cmp dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" cmp dword ptr [%s], 0x%X", VariableName, Const);
PUTDST16(RecompPos, 0x3D81); PUTDST16(RecompPos, 0x3D81);
@ -810,7 +810,7 @@ void CompConstToVariable(uint32_t Const, void * Variable, char * VariableName)
PUTDST32(RecompPos, Const); PUTDST32(RecompPos, Const);
} }
void CompConstHalfToVariable(uint16_t Const, void * Variable, char * VariableName) void CompConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" cmp word ptr [%s], 0x%X", VariableName, Const); CPU_Message(" cmp word ptr [%s], 0x%X", VariableName, Const);
PUTDST8(RecompPos, 0x66); PUTDST8(RecompPos, 0x66);
@ -858,7 +858,7 @@ void CompConstToX86reg(int x86Reg, uint32_t Const)
} }
} }
void CompX86regToVariable(int x86Reg, void * Variable, char * VariableName) void CompX86regToVariable(int x86Reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" cmp %s, dword ptr [%s]", x86_Name(x86Reg), VariableName); CPU_Message(" cmp %s, dword ptr [%s]", x86_Name(x86Reg), VariableName);
switch (x86Reg) switch (x86Reg)
@ -877,7 +877,7 @@ void CompX86regToVariable(int x86Reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void CompVariableToX86reg(int x86Reg, void * Variable, char * VariableName) void CompVariableToX86reg(int x86Reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" cmp dword ptr [%s], %s", VariableName, x86_Name(x86Reg)); CPU_Message(" cmp dword ptr [%s], %s", VariableName, x86_Name(x86Reg));
switch (x86Reg) switch (x86Reg)
@ -1061,105 +1061,105 @@ void IncX86reg(int x86Reg)
} }
} }
void JaeLabel32(char * Label, uint32_t Value) void JaeLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jae $%s", Label); CPU_Message(" jae $%s", Label);
PUTDST16(RecompPos, 0x830F); PUTDST16(RecompPos, 0x830F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JaLabel8(char * Label, uint8_t Value) void JaLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" ja $%s", Label); CPU_Message(" ja $%s", Label);
PUTDST8(RecompPos, 0x77); PUTDST8(RecompPos, 0x77);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JaLabel32(char * Label, uint32_t Value) void JaLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" ja $%s", Label); CPU_Message(" ja $%s", Label);
PUTDST16(RecompPos, 0x870F); PUTDST16(RecompPos, 0x870F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JbLabel8(char * Label, uint8_t Value) void JbLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jb $%s", Label); CPU_Message(" jb $%s", Label);
PUTDST8(RecompPos, 0x72); PUTDST8(RecompPos, 0x72);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JbLabel32(char * Label, uint32_t Value) void JbLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jb $%s", Label); CPU_Message(" jb $%s", Label);
PUTDST16(RecompPos, 0x820F); PUTDST16(RecompPos, 0x820F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JeLabel8(char * Label, uint8_t Value) void JeLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" je $%s", Label); CPU_Message(" je $%s", Label);
PUTDST8(RecompPos, 0x74); PUTDST8(RecompPos, 0x74);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JeLabel32(char * Label, uint32_t Value) void JeLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" je $%s", Label); CPU_Message(" je $%s", Label);
PUTDST16(RecompPos, 0x840F); PUTDST16(RecompPos, 0x840F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JgeLabel8(char * Label, uint8_t Value) void JgeLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jge $%s", Label); CPU_Message(" jge $%s", Label);
PUTDST8(RecompPos, 0x7D); PUTDST8(RecompPos, 0x7D);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JgeLabel32(char * Label, uint32_t Value) void JgeLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jge $%s", Label); CPU_Message(" jge $%s", Label);
PUTDST16(RecompPos, 0x8D0F); PUTDST16(RecompPos, 0x8D0F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JgLabel8(char * Label, uint8_t Value) void JgLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jg $%s", Label); CPU_Message(" jg $%s", Label);
PUTDST8(RecompPos, 0x7F); PUTDST8(RecompPos, 0x7F);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JgLabel32(char * Label, uint32_t Value) void JgLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jg $%s", Label); CPU_Message(" jg $%s", Label);
PUTDST16(RecompPos, 0x8F0F); PUTDST16(RecompPos, 0x8F0F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JleLabel8(char * Label, uint8_t Value) void JleLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jle $%s", Label); CPU_Message(" jle $%s", Label);
PUTDST8(RecompPos, 0x7E); PUTDST8(RecompPos, 0x7E);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JleLabel32(char * Label, uint32_t Value) void JleLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jle $%s", Label); CPU_Message(" jle $%s", Label);
PUTDST16(RecompPos, 0x8E0F); PUTDST16(RecompPos, 0x8E0F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JlLabel8(char * Label, uint8_t Value) void JlLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jl $%s", Label); CPU_Message(" jl $%s", Label);
PUTDST8(RecompPos, 0x7C); PUTDST8(RecompPos, 0x7C);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JlLabel32(char * Label, uint32_t Value) void JlLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jl $%s", Label); CPU_Message(" jl $%s", Label);
PUTDST16(RecompPos, 0x8C0F); PUTDST16(RecompPos, 0x8C0F);
@ -1182,49 +1182,49 @@ void JumpX86Reg(int x86reg)
} }
} }
void JmpLabel8(char * Label, uint8_t Value) void JmpLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jmp $%s", Label); CPU_Message(" jmp $%s", Label);
PUTDST8(RecompPos, 0xEB); PUTDST8(RecompPos, 0xEB);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JmpLabel32(char * Label, uint32_t Value) void JmpLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jmp $%s", Label); CPU_Message(" jmp $%s", Label);
PUTDST8(RecompPos, 0xE9); PUTDST8(RecompPos, 0xE9);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JneLabel8(char * Label, uint8_t Value) void JneLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jne $%s", Label); CPU_Message(" jne $%s", Label);
PUTDST8(RecompPos, 0x75); PUTDST8(RecompPos, 0x75);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JneLabel32(char * Label, uint32_t Value) void JneLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jne $%s", Label); CPU_Message(" jne $%s", Label);
PUTDST16(RecompPos, 0x850F); PUTDST16(RecompPos, 0x850F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JnsLabel8(char * Label, uint8_t Value) void JnsLabel8(const char * Label, uint8_t Value)
{ {
CPU_Message(" jns $%s", Label); CPU_Message(" jns $%s", Label);
PUTDST8(RecompPos, 0x79); PUTDST8(RecompPos, 0x79);
PUTDST8(RecompPos, Value); PUTDST8(RecompPos, Value);
} }
void JnsLabel32(char * Label, uint32_t Value) void JnsLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" jns $%s", Label); CPU_Message(" jns $%s", Label);
PUTDST16(RecompPos, 0x890F); PUTDST16(RecompPos, 0x890F);
PUTDST32(RecompPos, Value); PUTDST32(RecompPos, Value);
} }
void JsLabel32(char * Label, uint32_t Value) void JsLabel32(const char * Label, uint32_t Value)
{ {
CPU_Message(" js $%s", Label); CPU_Message(" js $%s", Label);
PUTDST16(RecompPos, 0x880F); PUTDST16(RecompPos, 0x880F);
@ -1300,7 +1300,11 @@ void MoveConstByteToN64Mem(uint8_t Const, int AddrReg)
} }
PUTDST16(RecompPos, x86Command); PUTDST16(RecompPos, x86Command);
#if defined(_M_IX86) && defined(_MSC_VER)
PUTDST32(RecompPos, RSPInfo.DMEM); PUTDST32(RecompPos, RSPInfo.DMEM);
#else
g_Notify->BreakPoint(__FILE__, __LINE__);
#endif
PUTDST8(RecompPos, Const); PUTDST8(RecompPos, Const);
} }
@ -1325,11 +1329,15 @@ void MoveConstHalfToN64Mem(uint16_t Const, int AddrReg)
} }
PUTDST8(RecompPos, x86Command); PUTDST8(RecompPos, x86Command);
#if defined(_M_IX86) && defined(_MSC_VER)
PUTDST32(RecompPos, RSPInfo.DMEM); PUTDST32(RecompPos, RSPInfo.DMEM);
#else
g_Notify->BreakPoint(__FILE__, __LINE__);
#endif
PUTDST16(RecompPos, Const); PUTDST16(RecompPos, Const);
} }
void MoveConstByteToVariable(uint8_t Const, void * Variable, char * VariableName) void MoveConstByteToVariable(uint8_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" mov byte ptr [%s], %Xh", VariableName, Const); CPU_Message(" mov byte ptr [%s], %Xh", VariableName, Const);
PUTDST16(RecompPos, 0x05C6); PUTDST16(RecompPos, 0x05C6);
@ -1337,7 +1345,7 @@ void MoveConstByteToVariable(uint8_t Const, void * Variable, char * VariableName
PUTDST8(RecompPos, Const); PUTDST8(RecompPos, Const);
} }
void MoveConstHalfToVariable(uint16_t Const, void * Variable, char * VariableName) void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" mov word ptr [%s], %Xh", VariableName, Const); CPU_Message(" mov word ptr [%s], %Xh", VariableName, Const);
PUTDST8(RecompPos, 0x66); PUTDST8(RecompPos, 0x66);
@ -1366,11 +1374,15 @@ void MoveConstToN64Mem(uint32_t Const, int AddrReg)
} }
PUTDST16(RecompPos, x86Command); PUTDST16(RecompPos, x86Command);
#if defined(_M_IX86) && defined(_MSC_VER)
PUTDST32(RecompPos, RSPInfo.DMEM); PUTDST32(RecompPos, RSPInfo.DMEM);
#else
g_Notify->BreakPoint(__FILE__, __LINE__);
#endif
PUTDST32(RecompPos, Const); PUTDST32(RecompPos, Const);
} }
void MoveConstToVariable(uint32_t Const, void * Variable, char * VariableName) void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" mov dword ptr [%s], %Xh", VariableName, Const); CPU_Message(" mov dword ptr [%s], %Xh", VariableName, Const);
PUTDST16(RecompPos, 0x05C7); PUTDST16(RecompPos, 0x05C7);
@ -1397,7 +1409,7 @@ void MoveConstToX86reg(uint32_t Const, int x86reg)
PUTDST32(RecompPos, Const); PUTDST32(RecompPos, Const);
} }
void MoveOffsetToX86reg(size_t Const, char * VariableName, int x86reg) void MoveOffsetToX86reg(size_t Const, const char * VariableName, int x86reg)
{ {
CPU_Message(" mov %s, offset %s", x86_Name(x86reg), VariableName); CPU_Message(" mov %s, offset %s", x86_Name(x86reg), VariableName);
switch (x86reg) switch (x86reg)
@ -1940,7 +1952,7 @@ void MoveX86regToN64MemDisp(int x86reg, int AddrReg, uint8_t Disp)
PUTDSTPTR(RecompPos, RSPInfo.DMEM + Disp); PUTDSTPTR(RecompPos, RSPInfo.DMEM + Disp);
} }
void MoveVariableToX86reg(void * Variable, char * VariableName, int x86reg) void MoveVariableToX86reg(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" mov %s, dword ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" mov %s, dword ptr [%s]", x86_Name(x86reg), VariableName);
switch (x86reg) switch (x86reg)
@ -1958,7 +1970,7 @@ void MoveVariableToX86reg(void * Variable, char * VariableName, int x86reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveVariableToX86regByte(void * Variable, char * VariableName, int x86reg) void MoveVariableToX86regByte(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" mov %s, byte ptr [%s]", x86Byte_Name(x86reg), VariableName); CPU_Message(" mov %s, byte ptr [%s]", x86Byte_Name(x86reg), VariableName);
switch (x86reg) switch (x86reg)
@ -1972,7 +1984,7 @@ void MoveVariableToX86regByte(void * Variable, char * VariableName, int x86reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveVariableToX86regHalf(void * Variable, char * VariableName, int x86reg) void MoveVariableToX86regHalf(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" mov %s, word ptr [%s]", x86Half_Name(x86reg), VariableName); CPU_Message(" mov %s, word ptr [%s]", x86Half_Name(x86reg), VariableName);
PUTDST8(RecompPos, 0x66); PUTDST8(RecompPos, 0x66);
@ -1991,7 +2003,7 @@ void MoveVariableToX86regHalf(void * Variable, char * VariableName, int x86reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveX86regByteToVariable(int x86reg, void * Variable, char * VariableName) void MoveX86regByteToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" mov byte ptr [%s], %s", VariableName, x86Byte_Name(x86reg)); CPU_Message(" mov byte ptr [%s], %s", VariableName, x86Byte_Name(x86reg));
switch (x86reg) switch (x86reg)
@ -2006,7 +2018,7 @@ void MoveX86regByteToVariable(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveX86regHalfToVariable(int x86reg, void * Variable, char * VariableName) void MoveX86regHalfToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" mov word ptr [%s], %s", VariableName, x86Half_Name(x86reg)); CPU_Message(" mov word ptr [%s], %s", VariableName, x86Half_Name(x86reg));
PUTDST8(RecompPos, 0x66); PUTDST8(RecompPos, 0x66);
@ -2026,7 +2038,7 @@ void MoveX86regHalfToVariable(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveX86regToVariable(int x86reg, void * Variable, char * VariableName) void MoveX86regToVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" mov dword ptr [%s], %s", VariableName, x86_Name(x86reg)); CPU_Message(" mov dword ptr [%s], %s", VariableName, x86_Name(x86reg));
switch (x86reg) switch (x86reg)
@ -2144,7 +2156,7 @@ void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination)
PUTDST8(RecompPos, Disp); PUTDST8(RecompPos, Disp);
} }
void MoveSxVariableToX86regByte(void * Variable, char * VariableName, int x86reg) void MoveSxVariableToX86regByte(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" movsx %s, byte ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" movsx %s, byte ptr [%s]", x86_Name(x86reg), VariableName);
@ -2165,7 +2177,7 @@ void MoveSxVariableToX86regByte(void * Variable, char * VariableName, int x86reg
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveSxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg) void MoveSxVariableToX86regHalf(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" movsx %s, word ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" movsx %s, word ptr [%s]", x86_Name(x86reg), VariableName);
@ -2318,7 +2330,7 @@ void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination)
PUTDST8(RecompPos, Disp); PUTDST8(RecompPos, Disp);
} }
void MoveZxVariableToX86regByte(void * Variable, char * VariableName, int x86reg) void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" movzx %s, byte ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" movzx %s, byte ptr [%s]", x86_Name(x86reg), VariableName);
@ -2339,7 +2351,7 @@ void MoveZxVariableToX86regByte(void * Variable, char * VariableName, int x86reg
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void MoveZxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg) void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" movzx %s, word ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" movzx %s, word ptr [%s]", x86_Name(x86reg), VariableName);
@ -2479,7 +2491,7 @@ void NotX86reg(int x86reg)
} }
} }
void OrConstToVariable(uint32_t Const, void * Variable, char * VariableName) void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" or dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" or dword ptr [%s], 0x%X", VariableName, Const);
PUTDST16(RecompPos, 0x0D81); PUTDST16(RecompPos, 0x0D81);
@ -2522,7 +2534,7 @@ void OrConstToX86Reg(uint32_t Const, int x86Reg)
} }
} }
void OrVariableToX86Reg(void * Variable, char * VariableName, int x86Reg) void OrVariableToX86Reg(void * Variable, const char * VariableName, int x86Reg)
{ {
CPU_Message(" or %s, dword ptr [%s]", x86_Name(x86Reg), VariableName); CPU_Message(" or %s, dword ptr [%s]", x86_Name(x86Reg), VariableName);
switch (x86Reg) switch (x86Reg)
@ -2539,7 +2551,7 @@ void OrVariableToX86Reg(void * Variable, char * VariableName, int x86Reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void OrVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg) void OrVariableToX86regHalf(void * Variable, const char * VariableName, int x86Reg)
{ {
CPU_Message(" or %s, word ptr [%s]", x86Half_Name(x86Reg), VariableName); CPU_Message(" or %s, word ptr [%s]", x86Half_Name(x86Reg), VariableName);
PUTDST8(RecompPos, 0x66); PUTDST8(RecompPos, 0x66);
@ -2557,7 +2569,7 @@ void OrVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void OrX86RegToVariable(void * Variable, char * VariableName, int x86Reg) void OrX86RegToVariable(void * Variable, const char * VariableName, int x86Reg)
{ {
CPU_Message(" or dword ptr [%s], %s", VariableName, x86_Name(x86Reg)); CPU_Message(" or dword ptr [%s], %s", VariableName, x86_Name(x86Reg));
switch (x86Reg) switch (x86Reg)
@ -2650,7 +2662,7 @@ void Pop(int x86reg)
} }
} }
void PushImm32(char * String, uint32_t Value) void PushImm32(const char * String, uint32_t Value)
{ {
CPU_Message(" push %s", String); CPU_Message(" push %s", String);
PUTDST8(RecompPos, 0x68); PUTDST8(RecompPos, 0x68);
@ -2678,7 +2690,7 @@ void Setl(int x86reg)
} }
} }
void SetlVariable(void * Variable, char * VariableName) void SetlVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setl byte ptr [%s]", VariableName); CPU_Message(" setl byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x9C0F); PUTDST16(RecompPos, 0x9C0F);
@ -2686,7 +2698,7 @@ void SetlVariable(void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void SetleVariable(void * Variable, char * VariableName) void SetleVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setle byte ptr [%s]", VariableName); CPU_Message(" setle byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x9E0F); PUTDST16(RecompPos, 0x9E0F);
@ -2709,7 +2721,7 @@ void Setb(int x86reg)
} }
} }
void SetbVariable(void * Variable, char * VariableName) void SetbVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setb byte ptr [%s]", VariableName); CPU_Message(" setb byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x920F); PUTDST16(RecompPos, 0x920F);
@ -2732,7 +2744,7 @@ void Setg(int x86reg)
} }
} }
void SetgVariable(void * Variable, char * VariableName) void SetgVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setg byte ptr [%s]", VariableName); CPU_Message(" setg byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x9F0F); PUTDST16(RecompPos, 0x9F0F);
@ -2740,7 +2752,7 @@ void SetgVariable(void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void SetgeVariable(void * Variable, char * VariableName) void SetgeVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setge byte ptr [%s]", VariableName); CPU_Message(" setge byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x9D0F); PUTDST16(RecompPos, 0x9D0F);
@ -2763,7 +2775,7 @@ void Seta(int x86reg)
} }
} }
void SetaVariable(void * Variable, char * VariableName) void SetaVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" seta byte ptr [%s]", VariableName); CPU_Message(" seta byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x970F); PUTDST16(RecompPos, 0x970F);
@ -2801,7 +2813,7 @@ void Setz(int x86reg)
} }
} }
void SetzVariable(void * Variable, char * VariableName) void SetzVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setz byte ptr [%s]", VariableName); CPU_Message(" setz byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x940F); PUTDST16(RecompPos, 0x940F);
@ -2824,7 +2836,7 @@ void Setnz(int x86reg)
} }
} }
void SetnzVariable(void * Variable, char * VariableName) void SetnzVariable(void * Variable, const char * VariableName)
{ {
CPU_Message(" setnz byte ptr [%s]", VariableName); CPU_Message(" setnz byte ptr [%s]", VariableName);
PUTDST16(RecompPos, 0x950F); PUTDST16(RecompPos, 0x950F);
@ -2935,7 +2947,7 @@ void ShiftLeftSignImmed(int x86reg, uint8_t Immediate)
PUTDST8(RecompPos, Immediate); PUTDST8(RecompPos, Immediate);
} }
void ShiftLeftSignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate) void ShiftLeftSignVariableImmed(void * Variable, const char * VariableName, uint8_t Immediate)
{ {
CPU_Message(" shl dword ptr [%s], %Xh", VariableName, Immediate); CPU_Message(" shl dword ptr [%s], %Xh", VariableName, Immediate);
@ -2963,7 +2975,7 @@ void ShiftRightSignImmed(int x86reg, uint8_t Immediate)
PUTDST8(RecompPos, Immediate); PUTDST8(RecompPos, Immediate);
} }
void ShiftRightSignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate) void ShiftRightSignVariableImmed(void * Variable, const char * VariableName, uint8_t Immediate)
{ {
CPU_Message(" sar dword ptr [%s], %Xh", VariableName, Immediate); CPU_Message(" sar dword ptr [%s], %Xh", VariableName, Immediate);
@ -3005,7 +3017,7 @@ void ShiftRightUnsignImmed(int x86reg, uint8_t Immediate)
PUTDST8(RecompPos, Immediate); PUTDST8(RecompPos, Immediate);
} }
void ShiftRightUnsignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate) void ShiftRightUnsignVariableImmed(void * Variable, const char * VariableName, uint8_t Immediate)
{ {
CPU_Message(" shr dword ptr [%s], %Xh", VariableName, Immediate); CPU_Message(" shr dword ptr [%s], %Xh", VariableName, Immediate);
@ -3014,7 +3026,7 @@ void ShiftRightUnsignVariableImmed(void * Variable, char * VariableName, uint8_t
PUTDST8(RecompPos, Immediate); PUTDST8(RecompPos, Immediate);
} }
void SubConstFromVariable(uint32_t Const, void * Variable, char * VariableName) void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" sub dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" sub dword ptr [%s], 0x%X", VariableName, Const);
PUTDST16(RecompPos, 0x2D81); PUTDST16(RecompPos, 0x2D81);
@ -3057,7 +3069,7 @@ void SubConstFromX86Reg(int x86Reg, uint32_t Const)
} }
} }
void SubVariableFromX86reg(int x86reg, void * Variable, char * VariableName) void SubVariableFromX86reg(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" sub %s, dword ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" sub %s, dword ptr [%s]", x86_Name(x86reg), VariableName);
switch (x86reg) switch (x86reg)
@ -3076,7 +3088,7 @@ void SubVariableFromX86reg(int x86reg, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void SubX86regFromVariable(int x86reg, void * Variable, char * VariableName) void SubX86regFromVariable(int x86reg, void * Variable, const char * VariableName)
{ {
CPU_Message(" sub dword ptr [%s], %s", VariableName, x86_Name(x86reg)); CPU_Message(" sub dword ptr [%s], %s", VariableName, x86_Name(x86reg));
switch (x86reg) switch (x86reg)
@ -3153,7 +3165,7 @@ void SbbX86RegToX86Reg(int Destination, int Source)
PUTDST16(RecompPos, x86Command); PUTDST16(RecompPos, x86Command);
} }
void TestConstToVariable(uint32_t Const, void * Variable, char * VariableName) void TestConstToVariable(uint32_t Const, void * Variable, const char * VariableName)
{ {
CPU_Message(" test dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" test dword ptr [%s], 0x%X", VariableName, Const);
PUTDST16(RecompPos, 0x05F7); PUTDST16(RecompPos, 0x05F7);
@ -3244,7 +3256,7 @@ void XorConstToX86Reg(int x86Reg, uint32_t Const)
} }
} }
void XorConstToVariable(void * Variable, char * VariableName, uint32_t Const) void XorConstToVariable(void * Variable, const char * VariableName, uint32_t Const)
{ {
CPU_Message(" xor dword ptr [%s], 0x%X", VariableName, Const); CPU_Message(" xor dword ptr [%s], 0x%X", VariableName, Const);
@ -3285,7 +3297,7 @@ void XorX86RegToX86Reg(int Source, int Destination)
PUTDST16(RecompPos, x86Command); PUTDST16(RecompPos, x86Command);
} }
void XorVariableToX86reg(void * Variable, char * VariableName, int x86reg) void XorVariableToX86reg(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" xor %s, dword ptr [%s]", x86_Name(x86reg), VariableName); CPU_Message(" xor %s, dword ptr [%s]", x86_Name(x86reg), VariableName);
switch (x86reg) switch (x86reg)
@ -3303,7 +3315,7 @@ void XorVariableToX86reg(void * Variable, char * VariableName, int x86reg)
PUTDSTPTR(RecompPos, Variable); PUTDSTPTR(RecompPos, Variable);
} }
void XorX86RegToVariable(void * Variable, char * VariableName, int x86reg) void XorX86RegToVariable(void * Variable, const char * VariableName, int x86reg)
{ {
CPU_Message(" xor dword ptr [%s], %s", VariableName, x86_Name(x86reg)); CPU_Message(" xor dword ptr [%s], %s", VariableName, x86_Name(x86reg));
switch (x86reg) switch (x86reg)

View File

@ -38,39 +38,39 @@ enum sseRegValues
}; };
void AdcX86RegToX86Reg(int Destination, int Source); void AdcX86RegToX86Reg(int Destination, int Source);
void AdcX86regToVariable(int x86reg, void * Variable, char * VariableName); void AdcX86regToVariable(int x86reg, void * Variable, const char * VariableName);
void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName); void AdcX86regHalfToVariable(int x86reg, void * Variable, const char * VariableName);
void AdcConstToX86reg(uint8_t Constant, int x86reg); void AdcConstToX86reg(uint8_t Constant, int x86reg);
void AdcConstToVariable(void * Variable, char * VariableName, uint8_t Constant); void AdcConstToVariable(void * Variable, const char * VariableName, uint8_t Constant);
void AdcConstHalfToVariable(void * Variable, char * VariableName, uint8_t Constant); void AdcConstHalfToVariable(void * Variable, const char * VariableName, uint8_t Constant);
void AddConstToVariable(uint32_t Const, void * Variable, char * VariableName); void AddConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
void AddConstToX86Reg(int x86Reg, size_t Const); void AddConstToX86Reg(int x86Reg, size_t Const);
void AddVariableToX86reg(int x86reg, void * Variable, char * VariableName); void AddVariableToX86reg(int x86reg, void * Variable, const char * VariableName);
void AddX86regToVariable(int x86reg, void * Variable, char * VariableName); void AddX86regToVariable(int x86reg, void * Variable, const char * VariableName);
void AddX86regHalfToVariable(int x86reg, void * Variable, char * VariableName); void AddX86regHalfToVariable(int x86reg, void * Variable, const char * VariableName);
void AddX86RegToX86Reg(int Destination, int Source); void AddX86RegToX86Reg(int Destination, int Source);
void AndConstToVariable(uint32_t Const, void * Variable, char * VariableName); void AndConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
void AndConstToX86Reg(int x86Reg, uint32_t Const); void AndConstToX86Reg(int x86Reg, uint32_t Const);
void AndVariableToX86Reg(void * Variable, char * VariableName, int x86Reg); void AndVariableToX86Reg(void * Variable, const char * VariableName, int x86Reg);
void AndVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg); void AndVariableToX86regHalf(void * Variable, const char * VariableName, int x86Reg);
void AndX86RegToVariable(void * Variable, char * VariableName, int x86Reg); void AndX86RegToVariable(void * Variable, const char * VariableName, int x86Reg);
void AndX86RegToX86Reg(int Destination, int Source); void AndX86RegToX86Reg(int Destination, int Source);
void AndX86RegHalfToX86RegHalf(int Destination, int Source); void AndX86RegHalfToX86RegHalf(int Destination, int Source);
void X86BreakPoint(const char * FileName, int LineNumber); void X86BreakPoint(const char * FileName, int LineNumber);
void BsrX86RegToX86Reg(int Destination, int Source); void BsrX86RegToX86Reg(int Destination, int Source);
void Call_Direct(void * FunctAddress, char * FunctName); void Call_Direct(void * FunctAddress, const char * FunctName);
void Call_Indirect(void * FunctAddress, char * FunctName); void Call_Indirect(void * FunctAddress, const char * FunctName);
void CondMoveEqual(int Destination, int Source); void CondMoveEqual(int Destination, int Source);
void CondMoveNotEqual(int Destination, int Source); void CondMoveNotEqual(int Destination, int Source);
void CondMoveGreater(int Destination, int Source); void CondMoveGreater(int Destination, int Source);
void CondMoveGreaterEqual(int Destination, int Source); void CondMoveGreaterEqual(int Destination, int Source);
void CondMoveLess(int Destination, int Source); void CondMoveLess(int Destination, int Source);
void CondMoveLessEqual(int Destination, int Source); void CondMoveLessEqual(int Destination, int Source);
void CompConstToVariable(uint32_t Const, void * Variable, char * VariableName); void CompConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
void CompConstHalfToVariable(uint16_t Const, void * Variable, char * VariableName); void CompConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
void CompConstToX86reg(int x86Reg, uint32_t Const); void CompConstToX86reg(int x86Reg, uint32_t Const);
void CompX86regToVariable(int x86Reg, void * Variable, char * VariableName); void CompX86regToVariable(int x86Reg, void * Variable, const char * VariableName);
void CompVariableToX86reg(int x86Reg, void * Variable, char * VariableName); void CompVariableToX86reg(int x86Reg, void * Variable, const char * VariableName);
void CompX86RegToX86Reg(int Destination, int Source); void CompX86RegToX86Reg(int Destination, int Source);
void Cwd(void); void Cwd(void);
void Cwde(void); void Cwde(void);
@ -80,39 +80,39 @@ void idivX86reg(int x86reg);
void imulX86reg(int x86reg); void imulX86reg(int x86reg);
void ImulX86RegToX86Reg(int Destination, int Source); void ImulX86RegToX86Reg(int Destination, int Source);
void IncX86reg(int x86Reg); void IncX86reg(int x86Reg);
void JaeLabel32(char * Label, uint32_t Value); void JaeLabel32(const char * Label, uint32_t Value);
void JaLabel8(char * Label, uint8_t Value); void JaLabel8(const char * Label, uint8_t Value);
void JaLabel32(char * Label, uint32_t Value); void JaLabel32(const char * Label, uint32_t Value);
void JbLabel8(char * Label, uint8_t Value); void JbLabel8(const char * Label, uint8_t Value);
void JbLabel32(char * Label, uint32_t Value); void JbLabel32(const char * Label, uint32_t Value);
void JeLabel8(char * Label, uint8_t Value); void JeLabel8(const char * Label, uint8_t Value);
void JeLabel32(char * Label, uint32_t Value); void JeLabel32(const char * Label, uint32_t Value);
void JgeLabel8(char * Label, uint8_t Value); void JgeLabel8(const char * Label, uint8_t Value);
void JgeLabel32(char * Label, uint32_t Value); void JgeLabel32(const char * Label, uint32_t Value);
void JgLabel8(char * Label, uint8_t Value); void JgLabel8(const char * Label, uint8_t Value);
void JgLabel32(char * Label, uint32_t Value); void JgLabel32(const char * Label, uint32_t Value);
void JleLabel8(char * Label, uint8_t Value); void JleLabel8(const char * Label, uint8_t Value);
void JleLabel32(char * Label, uint32_t Value); void JleLabel32(const char * Label, uint32_t Value);
void JlLabel8(char * Label, uint8_t Value); void JlLabel8(const char * Label, uint8_t Value);
void JlLabel32(char * Label, uint32_t Value); void JlLabel32(const char * Label, uint32_t Value);
void JumpX86Reg(int x86reg); void JumpX86Reg(int x86reg);
void JmpLabel8(char * Label, uint8_t Value); void JmpLabel8(const char * Label, uint8_t Value);
void JmpLabel32(char * Label, uint32_t Value); void JmpLabel32(const char * Label, uint32_t Value);
void JneLabel8(char * Label, uint8_t Value); void JneLabel8(const char * Label, uint8_t Value);
void JneLabel32(char * Label, uint32_t Value); void JneLabel32(const char * Label, uint32_t Value);
void JnsLabel8(char * Label, uint8_t Value); void JnsLabel8(const char * Label, uint8_t Value);
void JnsLabel32(char * Label, uint32_t Value); void JnsLabel32(const char * Label, uint32_t Value);
void JsLabel32(char * Label, uint32_t Value); void JsLabel32(const char * Label, uint32_t Value);
void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, size_t offset); void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, size_t offset);
void MoveConstByteToN64Mem(uint8_t Const, int AddrReg); void MoveConstByteToN64Mem(uint8_t Const, int AddrReg);
void MoveConstHalfToN64Mem(uint16_t Const, int AddrReg); void MoveConstHalfToN64Mem(uint16_t Const, int AddrReg);
void MoveConstByteToVariable(uint8_t Const, void * Variable, char * VariableName); void MoveConstByteToVariable(uint8_t Const, void * Variable, const char * VariableName);
void MoveConstHalfToVariable(uint16_t Const, void * Variable, char * VariableName); void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
void MoveConstToN64Mem(uint32_t Const, int AddrReg); void MoveConstToN64Mem(uint32_t Const, int AddrReg);
void MoveConstToN64MemDisp(uint32_t Const, int AddrReg, uint8_t Disp); void MoveConstToN64MemDisp(uint32_t Const, int AddrReg, uint8_t Disp);
void MoveConstToVariable(uint32_t Const, void * Variable, char * VariableName); void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
void MoveConstToX86reg(uint32_t Const, int x86reg); void MoveConstToX86reg(uint32_t Const, int x86reg);
void MoveOffsetToX86reg(size_t Const, char * VariableName, int x86reg); void MoveOffsetToX86reg(size_t Const, const char * VariableName, int x86reg);
void MoveX86regByteToX86regPointer(int Source, int AddrReg); void MoveX86regByteToX86regPointer(int Source, int AddrReg);
void MoveX86regHalfToX86regPointer(int Source, int AddrReg); void MoveX86regHalfToX86regPointer(int Source, int AddrReg);
void MoveX86regHalfToX86regPointerDisp(int Source, int AddrReg, uint8_t Disp); void MoveX86regHalfToX86regPointerDisp(int Source, int AddrReg, uint8_t Disp);
@ -126,42 +126,42 @@ void MoveN64MemToX86reg(int x86reg, int AddrReg);
void MoveN64MemToX86regByte(int x86reg, int AddrReg); void MoveN64MemToX86regByte(int x86reg, int AddrReg);
void MoveN64MemToX86regHalf(int x86reg, int AddrReg); void MoveN64MemToX86regHalf(int x86reg, int AddrReg);
void MoveX86regByteToN64Mem(int x86reg, int AddrReg); void MoveX86regByteToN64Mem(int x86reg, int AddrReg);
void MoveX86regByteToVariable(int x86reg, void * Variable, char * VariableName); void MoveX86regByteToVariable(int x86reg, void * Variable, const char * VariableName);
void MoveX86regHalfToN64Mem(int x86reg, int AddrReg); void MoveX86regHalfToN64Mem(int x86reg, int AddrReg);
void MoveX86regHalfToVariable(int x86reg, void * Variable, char * VariableName); void MoveX86regHalfToVariable(int x86reg, void * Variable, const char * VariableName);
void MoveX86regToN64Mem(int x86reg, int AddrReg); void MoveX86regToN64Mem(int x86reg, int AddrReg);
void MoveX86regToN64MemDisp(int x86reg, int AddrReg, uint8_t Disp); void MoveX86regToN64MemDisp(int x86reg, int AddrReg, uint8_t Disp);
void MoveX86regToVariable(int x86reg, void * Variable, char * VariableName); void MoveX86regToVariable(int x86reg, void * Variable, const char * VariableName);
void MoveX86RegToX86Reg(int Source, int Destination); void MoveX86RegToX86Reg(int Source, int Destination);
void MoveVariableToX86reg(void * Variable, char * VariableName, int x86reg); void MoveVariableToX86reg(void * Variable, const char * VariableName, int x86reg);
void MoveVariableToX86regByte(void * Variable, char * VariableName, int x86reg); void MoveVariableToX86regByte(void * Variable, const char * VariableName, int x86reg);
void MoveVariableToX86regHalf(void * Variable, char * VariableName, int x86reg); void MoveVariableToX86regHalf(void * Variable, const char * VariableName, int x86reg);
void MoveSxX86RegHalfToX86Reg(int Source, int Destination); void MoveSxX86RegHalfToX86Reg(int Source, int Destination);
void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination); void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination);
void MoveSxN64MemToX86regByte(int x86reg, int AddrReg); void MoveSxN64MemToX86regByte(int x86reg, int AddrReg);
void MoveSxN64MemToX86regHalf(int x86reg, int AddrReg); void MoveSxN64MemToX86regHalf(int x86reg, int AddrReg);
void MoveSxVariableToX86regByte(void * Variable, char * VariableName, int x86reg); void MoveSxVariableToX86regByte(void * Variable, const char * VariableName, int x86reg);
void MoveSxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg); void MoveSxVariableToX86regHalf(void * Variable, const char * VariableName, int x86reg);
void MoveZxX86RegHalfToX86Reg(int Source, int Destination); void MoveZxX86RegHalfToX86Reg(int Source, int Destination);
void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination); void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination);
void MoveZxN64MemToX86regByte(int x86reg, int AddrReg); void MoveZxN64MemToX86regByte(int x86reg, int AddrReg);
void MoveZxN64MemToX86regHalf(int x86reg, int AddrReg); void MoveZxN64MemToX86regHalf(int x86reg, int AddrReg);
void MoveZxVariableToX86regByte(void * Variable, char * VariableName, int x86reg); void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, int x86reg);
void MoveZxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg); void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, int x86reg);
void MulX86reg(int x86reg); void MulX86reg(int x86reg);
void NegateX86reg(int x86reg); void NegateX86reg(int x86reg);
void NotX86reg(int x86reg); void NotX86reg(int x86reg);
void OrConstToVariable(uint32_t Const, void * Variable, char * VariableName); void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
void OrConstToX86Reg(uint32_t Const, int x86Reg); void OrConstToX86Reg(uint32_t Const, int x86Reg);
void OrVariableToX86Reg(void * Variable, char * VariableName, int x86Reg); void OrVariableToX86Reg(void * Variable, const char * VariableName, int x86Reg);
void OrVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg); void OrVariableToX86regHalf(void * Variable, const char * VariableName, int x86Reg);
void OrX86RegToVariable(void * Variable, char * VariableName, int x86Reg); void OrX86RegToVariable(void * Variable, const char * VariableName, int x86Reg);
void OrX86RegToX86Reg(int Destination, int Source); void OrX86RegToX86Reg(int Destination, int Source);
void Popad(void); void Popad(void);
void Pushad(void); void Pushad(void);
void Push(int x86reg); void Push(int x86reg);
void Pop(int x86reg); void Pop(int x86reg);
void PushImm32(char * String, uint32_t Value); void PushImm32(const char * String, uint32_t Value);
void Ret(void); void Ret(void);
void Seta(int x86reg); void Seta(int x86reg);
void Setae(int x86reg); void Setae(int x86reg);
@ -170,65 +170,65 @@ void Setb(int x86reg);
void Setg(int x86reg); void Setg(int x86reg);
void Setz(int x86reg); void Setz(int x86reg);
void Setnz(int x86reg); void Setnz(int x86reg);
void SetlVariable(void * Variable, char * VariableName); void SetlVariable(void * Variable, const char * VariableName);
void SetleVariable(void * Variable, char * VariableName); void SetleVariable(void * Variable, const char * VariableName);
void SetgVariable(void * Variable, char * VariableName); void SetgVariable(void * Variable, const char * VariableName);
void SetgeVariable(void * Variable, char * VariableName); void SetgeVariable(void * Variable, const char * VariableName);
void SetbVariable(void * Variable, char * VariableName); void SetbVariable(void * Variable, const char * VariableName);
void SetaVariable(void * Variable, char * VariableName); void SetaVariable(void * Variable, const char * VariableName);
void SetzVariable(void * Variable, char * VariableName); void SetzVariable(void * Variable, const char * VariableName);
void SetnzVariable(void * Variable, char * VariableName); void SetnzVariable(void * Variable, const char * VariableName);
void ShiftLeftSign(int x86reg); void ShiftLeftSign(int x86reg);
void ShiftLeftSignImmed(int x86reg, uint8_t Immediate); void ShiftLeftSignImmed(int x86reg, uint8_t Immediate);
void ShiftLeftSignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate); void ShiftLeftSignVariableImmed(void * Variable, const char * VariableName, uint8_t Immediate);
void ShiftRightSignImmed(int x86reg, uint8_t Immediate); void ShiftRightSignImmed(int x86reg, uint8_t Immediate);
void ShiftRightSignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate); void ShiftRightSignVariableImmed(void * Variable, const char * VariableName, uint8_t Immediate);
void ShiftRightUnsign(int x86reg); void ShiftRightUnsign(int x86reg);
void ShiftRightUnsignImmed(int x86reg, uint8_t Immediate); void ShiftRightUnsignImmed(int x86reg, uint8_t Immediate);
void ShiftRightUnsignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate); void ShiftRightUnsignVariableImmed(void * Variable, const char * VariableName, uint8_t Immediate);
void ShiftLeftDoubleImmed(int Destination, int Source, uint8_t Immediate); void ShiftLeftDoubleImmed(int Destination, int Source, uint8_t Immediate);
void ShiftRightDoubleImmed(int Destination, int Source, uint8_t Immediate); void ShiftRightDoubleImmed(int Destination, int Source, uint8_t Immediate);
void SubConstFromVariable(uint32_t Const, void * Variable, char * VariableName); void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
void SubConstFromX86Reg(int x86Reg, uint32_t Const); void SubConstFromX86Reg(int x86Reg, uint32_t Const);
void SubVariableFromX86reg(int x86reg, void * Variable, char * VariableName); void SubVariableFromX86reg(int x86reg, void * Variable, const char * VariableName);
void SubX86RegToX86Reg(int Destination, int Source); void SubX86RegToX86Reg(int Destination, int Source);
void SubX86regFromVariable(int x86reg, void * Variable, char * VariableName); void SubX86regFromVariable(int x86reg, void * Variable, const char * VariableName);
void SbbX86RegToX86Reg(int Destination, int Source); void SbbX86RegToX86Reg(int Destination, int Source);
void TestConstToVariable(uint32_t Const, void * Variable, char * VariableName); void TestConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
void TestConstToX86Reg(uint32_t Const, int x86reg); void TestConstToX86Reg(uint32_t Const, int x86reg);
void TestX86RegToX86Reg(int Destination, int Source); void TestX86RegToX86Reg(int Destination, int Source);
void XorConstToX86Reg(int x86Reg, uint32_t Const); void XorConstToX86Reg(int x86Reg, uint32_t Const);
void XorX86RegToX86Reg(int Source, int Destination); void XorX86RegToX86Reg(int Source, int Destination);
void XorVariableToX86reg(void * Variable, char * VariableName, int x86reg); void XorVariableToX86reg(void * Variable, const char * VariableName, int x86reg);
void XorX86RegToVariable(void * Variable, char * VariableName, int x86reg); void XorX86RegToVariable(void * Variable, const char * VariableName, int x86reg);
void XorConstToVariable(void * Variable, char * VariableName, uint32_t Const); void XorConstToVariable(void * Variable, const char * VariableName, uint32_t Const);
#define _MMX_SHUFFLE(a, b, c, d) \ #define _MMX_SHUFFLE(a, b, c, d) \
((uint8_t)(((a) << 6) | ((b) << 4) | ((c) << 2) | (d))) ((uint8_t)(((a) << 6) | ((b) << 4) | ((c) << 2) | (d)))
void MmxMoveRegToReg(int Dest, int Source); void MmxMoveRegToReg(int Dest, int Source);
void MmxMoveQwordRegToVariable(int Dest, void * Variable, char * VariableName); void MmxMoveQwordRegToVariable(int Dest, void * Variable, const char * VariableName);
void MmxMoveQwordVariableToReg(int Dest, void * Variable, char * VariableName); void MmxMoveQwordVariableToReg(int Dest, void * Variable, const char * VariableName);
void MmxPandRegToReg(int Dest, int Source); void MmxPandRegToReg(int Dest, int Source);
void MmxPandnRegToReg(int Dest, int Source); void MmxPandnRegToReg(int Dest, int Source);
void MmxPandVariableToReg(void * Variable, char * VariableName, int Dest); void MmxPandVariableToReg(void * Variable, const char * VariableName, int Dest);
void MmxPorRegToReg(int Dest, int Source); void MmxPorRegToReg(int Dest, int Source);
void MmxPorVariableToReg(void * Variable, char * VariableName, int Dest); void MmxPorVariableToReg(void * Variable, const char * VariableName, int Dest);
void MmxXorRegToReg(int Dest, int Source); void MmxXorRegToReg(int Dest, int Source);
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, uint8_t Immed); void MmxShuffleMemoryToReg(int Dest, void * Variable, const char * VariableName, uint8_t Immed);
void MmxPcmpeqwRegToReg(int Dest, int Source); void MmxPcmpeqwRegToReg(int Dest, int Source);
void MmxPmullwRegToReg(int Dest, int Source); void MmxPmullwRegToReg(int Dest, int Source);
void MmxPmullwVariableToReg(int Dest, void * Variable, char * VariableName); void MmxPmullwVariableToReg(int Dest, void * Variable, const char * VariableName);
void MmxPmulhuwRegToReg(int Dest, int Source); void MmxPmulhuwRegToReg(int Dest, int Source);
void MmxPmulhwRegToReg(int Dest, int Source); void MmxPmulhwRegToReg(int Dest, int Source);
void MmxPmulhwRegToVariable(int Dest, void * Variable, char * VariableName); void MmxPmulhwRegToVariable(int Dest, void * Variable, const char * VariableName);
void MmxPsrlwImmed(int Dest, uint8_t Immed); void MmxPsrlwImmed(int Dest, uint8_t Immed);
void MmxPsrawImmed(int Dest, uint8_t Immed); void MmxPsrawImmed(int Dest, uint8_t Immed);
void MmxPsllwImmed(int Dest, uint8_t Immed); void MmxPsllwImmed(int Dest, uint8_t Immed);
void MmxPaddswRegToReg(int Dest, int Source); void MmxPaddswRegToReg(int Dest, int Source);
void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName); void MmxPaddswVariableToReg(int Dest, void * Variable, const char * VariableName);
void MmxPaddwRegToReg(int Dest, int Source); void MmxPaddwRegToReg(int Dest, int Source);
void MmxPsubswVariableToReg(int Dest, void * Variable, char * VariableName); void MmxPsubswVariableToReg(int Dest, void * Variable, const char * VariableName);
void MmxPsubswRegToReg(int Dest, int Source); void MmxPsubswRegToReg(int Dest, int Source);
void MmxPackSignedDwords(int Dest, int Source); void MmxPackSignedDwords(int Dest, int Source);
void MmxUnpackLowWord(int Dest, int Source); void MmxUnpackLowWord(int Dest, int Source);
@ -236,12 +236,12 @@ void MmxUnpackHighWord(int Dest, int Source);
void MmxCompareGreaterWordRegToReg(int Dest, int Source); void MmxCompareGreaterWordRegToReg(int Dest, int Source);
void MmxEmptyMultimediaState(void); void MmxEmptyMultimediaState(void);
void SseMoveAlignedVariableToReg(void * Variable, char * VariableName, int sseReg); void SseMoveAlignedVariableToReg(void * Variable, const char * VariableName, int sseReg);
void SseMoveAlignedRegToVariable(int sseReg, void * Variable, char * VariableName); void SseMoveAlignedRegToVariable(int sseReg, void * Variable, const char * VariableName);
void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg); void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg);
void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg); void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg);
void SseMoveUnalignedVariableToReg(void * Variable, char * VariableName, int sseReg); void SseMoveUnalignedVariableToReg(void * Variable, const char * VariableName, int sseReg);
void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, char * VariableName); void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, const char * VariableName);
void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg); void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg);
void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg); void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg);
void SseMoveRegToReg(int Dest, int Source); void SseMoveRegToReg(int Dest, int Source);

View File

@ -4,7 +4,7 @@
#include <Project64-rsp-core/cpu/RSPCpu.h> #include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Settings/Settings.h> #include <Settings/Settings.h>
uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0, Set_AllocatedRdramSize = 0; uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0, Set_AllocatedRdramSize = 0, Set_DirectoryLog = 0;
bool GraphicsHle = true, AudioHle, ConditionalMove, HleAlistTask = false; bool GraphicsHle = true, AudioHle, ConditionalMove, HleAlistTask = false;
bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, BreakOnStart = false, LogRDP = false, LogX86Code = false; bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, BreakOnStart = false, LogRDP = false, LogX86Code = false;
@ -14,6 +14,7 @@ void InitializeRspSetting(void)
Set_GraphicsHle = FindSystemSettingId("HLE GFX"); Set_GraphicsHle = FindSystemSettingId("HLE GFX");
Set_AudioHle = FindSystemSettingId("HLE Audio"); Set_AudioHle = FindSystemSettingId("HLE Audio");
Set_AllocatedRdramSize = FindSystemSettingId("AllocatedRdramSize"); Set_AllocatedRdramSize = FindSystemSettingId("AllocatedRdramSize");
Set_DirectoryLog = FindSystemSettingId("Dir:Log");
RegisterSetting(Set_BreakOnStart, Data_DWORD_General, "Break on Start", NULL, BreakOnStart, NULL); RegisterSetting(Set_BreakOnStart, Data_DWORD_General, "Break on Start", NULL, BreakOnStart, NULL);
RegisterSetting(Set_CPUCore, Data_DWORD_General, "CPU Method", NULL, g_CPUCore, NULL); RegisterSetting(Set_CPUCore, Data_DWORD_General, "CPU Method", NULL, g_CPUCore, NULL);

View File

@ -3,6 +3,6 @@
void InitializeRspSetting(void); void InitializeRspSetting(void);
extern uint16_t Set_AudioHle, Set_GraphicsHle, Set_AllocatedRdramSize; extern uint16_t Set_AudioHle, Set_GraphicsHle, Set_AllocatedRdramSize, Set_DirectoryLog;
extern bool GraphicsHle, AudioHle, ConditionalMove, HleAlistTask; extern bool GraphicsHle, AudioHle, ConditionalMove, HleAlistTask;
extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code; extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code;

View File

@ -1,3 +1,5 @@
#pragma once
#include "RSPOpcode.h" #include "RSPOpcode.h"
#include "RSPRegisterHandlerPlugin.h" #include "RSPRegisterHandlerPlugin.h"
#include "RspTypes.h" #include "RspTypes.h"

View File

@ -1203,7 +1203,7 @@ void RSP_Vector_VRCP(void)
else else
{ {
uint32_t Shift = clz32(Data); uint32_t Shift = clz32(Data);
uint32_t Index = (uint64_t(Data) << Shift & 0x7fc0'0000) >> 22; uint32_t Index = (uint64_t(Data) << Shift & 0x7fc00000) >> 22;
Result = (((0x10000 | Reciprocals[Index]) << 14) >> (31 - Shift)) ^ Mask; Result = (((0x10000 | Reciprocals[Index]) << 14) >> (31 - Shift)) ^ Mask;
} }
RcpHigh = false; RcpHigh = false;

View File

@ -1,4 +1,4 @@
#include "cpu/RspTypes.h" #include "RspTypes.h"
#include <string.h> #include <string.h>
// RSP registers // RSP registers
@ -14,7 +14,7 @@ RSPFlag VCOL(RSP_Flags[0].UB[0]), VCOH(RSP_Flags[0].UB[1]);
RSPFlag VCCL(RSP_Flags[1].UB[0]), VCCH(RSP_Flags[1].UB[1]); RSPFlag VCCL(RSP_Flags[1].UB[0]), VCCH(RSP_Flags[1].UB[1]);
RSPFlag VCE(RSP_Flags[2].UB[0]); RSPFlag VCE(RSP_Flags[2].UB[0]);
char * GPR_Strings[32] = { const char * GPR_Strings[32] = {
"R0", "R0",
"AT", "AT",
"V0", "V0",

View File

@ -71,8 +71,8 @@ enum
MI_INTR_SP = 0x01, // Bit 0: SP INTR MI_INTR_SP = 0x01, // Bit 0: SP INTR
}; };
extern char * x86_Strings[8]; extern const char * x86_Strings[8];
extern char * GPR_Strings[32]; extern const char * GPR_Strings[32];
#define x86_Name(Reg) (x86_Strings[(Reg)]) #define x86_Name(Reg) (x86_Strings[(Reg)])
#define GPR_Name(Reg) (GPR_Strings[(Reg)]) #define GPR_Name(Reg) (GPR_Strings[(Reg)])

View File

@ -5,6 +5,8 @@
#include <Common/StdString.h> #include <Common/StdString.h>
#include <Common/path.h> #include <Common/path.h>
#include <Project64-rsp-core/RSPInfo.h> #include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Settings/Settings.h>
CLog * RDPLog = NULL; CLog * RDPLog = NULL;
CLog * CPULog = NULL; CLog * CPULog = NULL;
@ -13,11 +15,10 @@ void StartCPULog(void)
{ {
if (CPULog == NULL) if (CPULog == NULL)
{ {
CPath LogFile(CPath::MODULE_DIRECTORY, "RSP_x86Log.txt"); char LogDir[260];
LogFile.AppendDirectory("Logs"); CPath LogFilePath(GetSystemSettingSz(Set_DirectoryLog, LogDir, sizeof(LogDir)), "RSP_x86Log.txt");
CPULog = new CLog; CPULog = new CLog;
CPULog->Open(LogFile); CPULog->Open(LogFilePath);
} }
} }
@ -51,13 +52,12 @@ void CPU_Message(const char * Message, ...)
void StartRDPLog(void) void StartRDPLog(void)
{ {
if (RDPLog == NULL) if (RDPLog == nullptr && Set_DirectoryLog != 0)
{ {
CPath LogFile(CPath::MODULE_DIRECTORY, "RDP_Log.txt"); char LogDir[260];
LogFile.AppendDirectory("Logs"); CPath LogFilePath(GetSystemSettingSz(Set_DirectoryLog, LogDir, sizeof(LogDir)), "RDP_Log.txt");
RDPLog = new CLog; RDPLog = new CLog;
RDPLog->Open(LogFile); RDPLog->Open(LogFilePath);
RDPLog->SetMaxFileSize(400 * 1024 * 1024); RDPLog->SetMaxFileSize(400 * 1024 * 1024);
// RDPLog->SetFlush(true); // RDPLog->SetFlush(true);
} }