commit
bc844a168f
|
@ -128,7 +128,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
|||
static struct IGDdatas data;
|
||||
int main()
|
||||
{
|
||||
char externalIP[16] = "";
|
||||
char externalIP[16] = \"\";
|
||||
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
|
||||
|
||||
return 0;
|
||||
|
@ -148,7 +148,7 @@ IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
|||
static struct IGDdatas data;
|
||||
int main()
|
||||
{
|
||||
char externalIP[16] = "";
|
||||
char externalIP[16] = \"\";
|
||||
UPNP_GetExternalIPAddress(urls.controlURL, data.servicetype, externalIP);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace AudioCommon
|
|||
{
|
||||
return true;
|
||||
}
|
||||
return SConfig::GetInstance().m_EnableJIT;
|
||||
return SConfig::GetInstance().m_DSPEnableJIT;
|
||||
}
|
||||
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
|
|
|
@ -15,22 +15,19 @@ soundtouch::SoundTouch soundTouch;
|
|||
//
|
||||
bool OpenALStream::Start()
|
||||
{
|
||||
ALDeviceList *pDeviceList = NULL;
|
||||
ALCcontext *pContext = NULL;
|
||||
ALCdevice *pDevice = NULL;
|
||||
bool bReturn = false;
|
||||
|
||||
pDeviceList = new ALDeviceList();
|
||||
ALDeviceList *pDeviceList = new ALDeviceList();
|
||||
if ((pDeviceList) && (pDeviceList->GetNumDevices()))
|
||||
{
|
||||
char *defDevName = pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice());
|
||||
|
||||
WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName);
|
||||
|
||||
pDevice = alcOpenDevice(defDevName);
|
||||
ALCdevice *pDevice = alcOpenDevice(defDevName);
|
||||
if (pDevice)
|
||||
{
|
||||
pContext = alcCreateContext(pDevice, NULL);
|
||||
ALCcontext *pContext = alcCreateContext(pDevice, NULL);
|
||||
if (pContext)
|
||||
{
|
||||
// Used to determine an appropriate period size (2x period = total buffer size)
|
||||
|
|
|
@ -42,10 +42,6 @@
|
|||
ALDeviceList::ALDeviceList()
|
||||
{
|
||||
ALDEVICEINFO ALDeviceInfo;
|
||||
char *devices;
|
||||
s32 index;
|
||||
const char *defaultDeviceName = NULL;
|
||||
const char *actualDeviceName = NULL;
|
||||
|
||||
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
|
||||
vDeviceInfo.clear();
|
||||
|
@ -57,11 +53,10 @@ ALDeviceList::ALDeviceList()
|
|||
//if (LoadOAL10Library(NULL, &ALFunction) == TRUE) {
|
||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
|
||||
{
|
||||
devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
index = 0;
|
||||
const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
||||
const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||
while (devices != NULL && strlen(devices) > 0)
|
||||
for (s32 index = 0; devices != NULL && strlen(devices) > 0; index++, devices += strlen(devices) + 1)
|
||||
{
|
||||
if (strcmp(defaultDeviceName, devices) == 0)
|
||||
{
|
||||
|
@ -75,7 +70,7 @@ ALDeviceList::ALDeviceList()
|
|||
{
|
||||
alcMakeContextCurrent(context);
|
||||
// if new actual device name isn't already in the list, then add it...
|
||||
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
||||
const char *actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
||||
bool bNewName = true;
|
||||
for (s32 i = 0; i < GetNumDevices(); i++)
|
||||
{
|
||||
|
@ -130,8 +125,6 @@ ALDeviceList::ALDeviceList()
|
|||
}
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
devices += strlen(devices) + 1;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -335,7 +335,7 @@ void ARMXEmitter::NOP(int count)
|
|||
void ARMXEmitter::SETEND(bool BE)
|
||||
{
|
||||
//SETEND is non-conditional
|
||||
Write32( 0xF1010000 | (BE << 9));
|
||||
Write32(0xF1010000 | (BE << 9));
|
||||
}
|
||||
void ARMXEmitter::BKPT(u16 arg)
|
||||
{
|
||||
|
@ -380,9 +380,8 @@ FixupBranch ARMXEmitter::B_CC(CCFlags Cond)
|
|||
void ARMXEmitter::B_CC(CCFlags Cond, const void *fnptr)
|
||||
{
|
||||
s32 distance = (s32)fnptr - (s32(code) + 8);
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -33554432
|
||||
&& distance <= 33554432,
|
||||
"B_CC out of range (%p calls %p)", code, fnptr);
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -0x2000000 && distance <= 0x2000000,
|
||||
"B_CC out of range (%p calls %p)", code, fnptr);
|
||||
|
||||
Write32((Cond << 28) | 0x0A000000 | ((distance >> 2) & 0x00FFFFFF));
|
||||
}
|
||||
|
@ -399,23 +398,17 @@ FixupBranch ARMXEmitter::BL_CC(CCFlags Cond)
|
|||
void ARMXEmitter::SetJumpTarget(FixupBranch const &branch)
|
||||
{
|
||||
s32 distance = (s32(code) - 8) - (s32)branch.ptr;
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -33554432
|
||||
&& distance <= 33554432,
|
||||
"SetJumpTarget out of range (%p calls %p)", code,
|
||||
branch.ptr);
|
||||
if(branch.type == 0) // B
|
||||
*(u32*)branch.ptr = (u32)(branch.condition | (10 << 24) | ((distance >> 2) &
|
||||
0x00FFFFFF));
|
||||
else // BL
|
||||
*(u32*)branch.ptr = (u32)(branch.condition | 0x0B000000 | ((distance >> 2)
|
||||
& 0x00FFFFFF));
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -0x2000000 && distance <= 0x2000000,
|
||||
"SetJumpTarget out of range (%p calls %p)", code, branch.ptr);
|
||||
u32 instr = (u32)(branch.condition | ((distance >> 2) & 0x00FFFFFF));
|
||||
instr |= branch.type ? /* B */ 0x0A000000 : /* BL */ 0x0B000000;
|
||||
*(u32*)branch.ptr = instr;
|
||||
}
|
||||
void ARMXEmitter::B (const void *fnptr)
|
||||
void ARMXEmitter::B(const void *fnptr)
|
||||
{
|
||||
s32 distance = (s32)fnptr - (s32(code) + 8);
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -33554432
|
||||
&& distance <= 33554432,
|
||||
"B out of range (%p calls %p)", code, fnptr);
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -0x2000000 && distance <= 0x2000000,
|
||||
"B out of range (%p calls %p)", code, fnptr);
|
||||
|
||||
Write32(condition | 0x0A000000 | ((distance >> 2) & 0x00FFFFFF));
|
||||
}
|
||||
|
@ -427,7 +420,7 @@ void ARMXEmitter::B(ARMReg src)
|
|||
|
||||
bool ARMXEmitter::BLInRange(const void *fnptr) {
|
||||
s32 distance = (s32)fnptr - (s32(code) + 8);
|
||||
if (distance <= -33554432 || distance > 33554432)
|
||||
if (distance <= -0x2000000 || distance > 0x2000000)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -436,9 +429,8 @@ bool ARMXEmitter::BLInRange(const void *fnptr) {
|
|||
void ARMXEmitter::BL(const void *fnptr)
|
||||
{
|
||||
s32 distance = (s32)fnptr - (s32(code) + 8);
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -33554432
|
||||
&& distance <= 33554432,
|
||||
"BL out of range (%p calls %p)", code, fnptr);
|
||||
_dbg_assert_msg_(DYNA_REC, distance > -0x2000000 && distance <= 0x2000000,
|
||||
"BL out of range (%p calls %p)", code, fnptr);
|
||||
Write32(condition | 0x0B000000 | ((distance >> 2) & 0x00FFFFFF));
|
||||
}
|
||||
void ARMXEmitter::BL(ARMReg src)
|
||||
|
@ -487,42 +479,42 @@ void ARMXEmitter::WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg
|
|||
// IMM, REG, IMMSREG, RSR
|
||||
// -1 for invalid if the instruction doesn't support that
|
||||
const s32 InstOps[][4] = {{16, 0, 0, 0}, // AND(s)
|
||||
{17, 1, 1, 1}, // EOR(s)
|
||||
{18, 2, 2, 2}, // SUB(s)
|
||||
{19, 3, 3, 3}, // RSB(s)
|
||||
{20, 4, 4, 4}, // ADD(s)
|
||||
{21, 5, 5, 5}, // ADC(s)
|
||||
{22, 6, 6, 6}, // SBC(s)
|
||||
{23, 7, 7, 7}, // RSC(s)
|
||||
{24, 8, 8, 8}, // TST
|
||||
{25, 9, 9, 9}, // TEQ
|
||||
{26, 10, 10, 10}, // CMP
|
||||
{27, 11, 11, 11}, // CMN
|
||||
{28, 12, 12, 12}, // ORR(s)
|
||||
{29, 13, 13, 13}, // MOV(s)
|
||||
{30, 14, 14, 14}, // BIC(s)
|
||||
{31, 15, 15, 15}, // MVN(s)
|
||||
{24, -1, -1, -1}, // MOVW
|
||||
{26, -1, -1, -1}, // MOVT
|
||||
};
|
||||
{17, 1, 1, 1}, // EOR(s)
|
||||
{18, 2, 2, 2}, // SUB(s)
|
||||
{19, 3, 3, 3}, // RSB(s)
|
||||
{20, 4, 4, 4}, // ADD(s)
|
||||
{21, 5, 5, 5}, // ADC(s)
|
||||
{22, 6, 6, 6}, // SBC(s)
|
||||
{23, 7, 7, 7}, // RSC(s)
|
||||
{24, 8, 8, 8}, // TST
|
||||
{25, 9, 9, 9}, // TEQ
|
||||
{26, 10, 10, 10}, // CMP
|
||||
{27, 11, 11, 11}, // CMN
|
||||
{28, 12, 12, 12}, // ORR(s)
|
||||
{29, 13, 13, 13}, // MOV(s)
|
||||
{30, 14, 14, 14}, // BIC(s)
|
||||
{31, 15, 15, 15}, // MVN(s)
|
||||
{24, -1, -1, -1}, // MOVW
|
||||
{26, -1, -1, -1}, // MOVT
|
||||
};
|
||||
|
||||
const char *InstNames[] = { "AND",
|
||||
"EOR",
|
||||
"SUB",
|
||||
"RSB",
|
||||
"ADD",
|
||||
"ADC",
|
||||
"SBC",
|
||||
"RSC",
|
||||
"TST",
|
||||
"TEQ",
|
||||
"CMP",
|
||||
"CMN",
|
||||
"ORR",
|
||||
"MOV",
|
||||
"BIC",
|
||||
"MVN"
|
||||
};
|
||||
const char *InstNames[] = {"AND",
|
||||
"EOR",
|
||||
"SUB",
|
||||
"RSB",
|
||||
"ADD",
|
||||
"ADC",
|
||||
"SBC",
|
||||
"RSC",
|
||||
"TST",
|
||||
"TEQ",
|
||||
"CMP",
|
||||
"CMN",
|
||||
"ORR",
|
||||
"MOV",
|
||||
"BIC",
|
||||
"MVN"
|
||||
};
|
||||
|
||||
void ARMXEmitter::AND (ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(0, Rd, Rn, Rm); }
|
||||
void ARMXEmitter::ANDS(ARMReg Rd, ARMReg Rn, Operand2 Rm) { WriteInstruction(0, Rd, Rn, Rm, true); }
|
||||
|
|
|
@ -735,8 +735,8 @@ public:
|
|||
{
|
||||
#ifndef __SYMBIAN32__
|
||||
FreeMemoryPages(region, region_size);
|
||||
#endif
|
||||
region = NULL;
|
||||
#endif
|
||||
region_size = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ std::vector<std::string> cdio_get_devices ()
|
|||
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
|
||||
{
|
||||
std::string drive = StringFromFormat(checklist[i].format, j);
|
||||
if ( (is_cdrom(drive, NULL)) > 0 )
|
||||
if (is_cdrom(drive, NULL))
|
||||
{
|
||||
drives.push_back(std::move(drive));
|
||||
}
|
||||
|
|
|
@ -25,6 +25,14 @@ extern const char *netplay_dolphin_ver;
|
|||
#define LOGGING 1
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || __clang__
|
||||
// Disable "unused function" warnings for the ones manually marked as such.
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
// Not sure MSVC even checks this...
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
#define STACKALIGN
|
||||
|
||||
#if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
|
|
|
@ -6,31 +6,18 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/Crypto/tools.h"
|
||||
|
||||
/*static void bn_print(char *name, u8 *a, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
printf("%s = ", name);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
printf("%02x", a[i]);
|
||||
|
||||
printf("\n");
|
||||
}*/
|
||||
|
||||
static void bn_zero(u8 *d, u32 n)
|
||||
{
|
||||
memset(d, 0, n);
|
||||
}
|
||||
|
||||
static void bn_copy(u8 *d, u8 *a, u32 n)
|
||||
static void bn_copy(u8 *d, const u8 *a, u32 n)
|
||||
{
|
||||
memcpy(d, a, n);
|
||||
}
|
||||
|
||||
int bn_compare(u8 *a, u8 *b, u32 n)
|
||||
int bn_compare(const u8 *a, const u8 *b, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
@ -44,7 +31,7 @@ int bn_compare(u8 *a, u8 *b, u32 n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void bn_sub_modulus(u8 *a, u8 *N, u32 n)
|
||||
void bn_sub_modulus(u8 *a, const u8 *N, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
u32 dig;
|
||||
|
@ -58,7 +45,7 @@ void bn_sub_modulus(u8 *a, u8 *N, u32 n)
|
|||
}
|
||||
}
|
||||
|
||||
void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
||||
void bn_add(u8 *d, const u8 *a, const u8 *b, const u8 *N, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
u32 dig;
|
||||
|
@ -78,7 +65,7 @@ void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
|||
bn_sub_modulus(d, N, n);
|
||||
}
|
||||
|
||||
void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
||||
void bn_mul(u8 *d, const u8 *a, const u8 *b, const u8 *N, u32 n)
|
||||
{
|
||||
u32 i;
|
||||
u8 mask;
|
||||
|
@ -93,7 +80,7 @@ void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n)
|
|||
}
|
||||
}
|
||||
|
||||
void bn_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en)
|
||||
void bn_exp(u8 *d, const u8 *a, const u8 *N, u32 n, const u8 *e, u32 en)
|
||||
{
|
||||
u8 t[512];
|
||||
u32 i;
|
||||
|
@ -112,7 +99,7 @@ void bn_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en)
|
|||
}
|
||||
|
||||
// only for prime N -- stupid but lazy, see if I care
|
||||
void bn_inv(u8 *d, u8 *a, u8 *N, u32 n)
|
||||
void bn_inv(u8 *d, const u8 *a, const u8 *N, u32 n)
|
||||
{
|
||||
u8 t[512], s[512];
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2014 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
// bignum arithmetic
|
||||
|
||||
int bn_compare(const u8 *a, const u8 *b, u32 n);
|
||||
void bn_sub_modulus(u8 *a, const u8 *N, u32 n);
|
||||
void bn_add(u8 *d, const u8 *a, const u8 *b, const u8 *N, u32 n);
|
||||
void bn_mul(u8 *d, const u8 *a, const u8 *b, const u8 *N, u32 n);
|
||||
void bn_inv(u8 *d, const u8 *a, const u8 *N, u32 n); // only for prime N
|
||||
void bn_exp(u8 *d, const u8 *a, const u8 *N, u32 n, const u8 *e, u32 en);
|
|
@ -12,38 +12,26 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/Crypto/tools.h"
|
||||
#include "Common/Crypto/bn.h"
|
||||
#include "Common/Crypto/ec.h"
|
||||
|
||||
// y**2 + x*y = x**3 + x + b
|
||||
/*
|
||||
static u8 ec_b[30] =
|
||||
UNUSED static const u8 ec_b[30] =
|
||||
{0x00,0x66,0x64,0x7e,0xde,0x6c,0x33,0x2c,0x7f,0x8c,0x09,0x23,0xbb,0x58,0x21
|
||||
,0x3b,0x33,0x3b,0x20,0xe9,0xce,0x42,0x81,0xfe,0x11,0x5f,0x7d,0x8f,0x90,0xad};
|
||||
*/
|
||||
|
||||
// order of the addition group of points
|
||||
static u8 ec_N[30] =
|
||||
static const u8 ec_N[30] =
|
||||
{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
,0x13,0xe9,0x74,0xe7,0x2f,0x8a,0x69,0x22,0x03,0x1d,0x26,0x03,0xcf,0xe0,0xd7};
|
||||
|
||||
// base point
|
||||
static u8 ec_G[60] =
|
||||
static const u8 ec_G[60] =
|
||||
{0x00,0xfa,0xc9,0xdf,0xcb,0xac,0x83,0x13,0xbb,0x21,0x39,0xf1,0xbb,0x75,0x5f
|
||||
,0xef,0x65,0xbc,0x39,0x1f,0x8b,0x36,0xf8,0xf8,0xeb,0x73,0x71,0xfd,0x55,0x8b
|
||||
,0x01,0x00,0x6a,0x08,0xa4,0x19,0x03,0x35,0x06,0x78,0xe5,0x85,0x28,0xbe,0xbf
|
||||
,0x8a,0x0b,0xef,0xf8,0x67,0xa7,0xca,0x36,0x71,0x6f,0x7e,0x01,0xf8,0x10,0x52};
|
||||
|
||||
/*static void elt_print(char *name, u8 *a)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
printf("%s = ", name);
|
||||
|
||||
for (i = 0; i < 30; i++)
|
||||
printf("%02x", a[i]);
|
||||
|
||||
printf("\n");
|
||||
}*/
|
||||
|
||||
static void elt_copy(u8 *d, const u8 *a)
|
||||
{
|
||||
memcpy(d, a, 30);
|
||||
|
@ -54,7 +42,7 @@ static void elt_zero(u8 *d)
|
|||
memset(d, 0, 30);
|
||||
}
|
||||
|
||||
static int elt_is_zero(u8 *d)
|
||||
static int elt_is_zero(const u8 *d)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
@ -65,7 +53,7 @@ static int elt_is_zero(u8 *d)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void elt_add(u8 *d, u8 *a, u8 *b)
|
||||
static void elt_add(u8 *d, const u8 *a, const u8 *b)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
@ -73,7 +61,7 @@ static void elt_add(u8 *d, u8 *a, u8 *b)
|
|||
d[i] = a[i] ^ b[i];
|
||||
}
|
||||
|
||||
static void elt_mul_x(u8 *d, u8 *a)
|
||||
static void elt_mul_x(u8 *d, const u8 *a)
|
||||
{
|
||||
u8 carry, x, y;
|
||||
u32 i;
|
||||
|
@ -91,7 +79,7 @@ static void elt_mul_x(u8 *d, u8 *a)
|
|||
d[20] ^= carry << 2;
|
||||
}
|
||||
|
||||
static void elt_mul(u8 *d, u8 *a, u8 *b)
|
||||
static void elt_mul(u8 *d, const u8 *a, const u8 *b)
|
||||
{
|
||||
u32 i, n;
|
||||
u8 mask;
|
||||
|
@ -115,9 +103,9 @@ static void elt_mul(u8 *d, u8 *a, u8 *b)
|
|||
}
|
||||
|
||||
static const u8 square[16] =
|
||||
{0x00,0x01,0x04,0x05,0x10,0x11,0x14,0x15,0x40,0x41,0x44,0x45,0x50,0x51,0x54,0x55};
|
||||
{0x00,0x01,0x04,0x05,0x10,0x11,0x14,0x15,0x40,0x41,0x44,0x45,0x50,0x51,0x54,0x55};
|
||||
|
||||
static void elt_square_to_wide(u8 *d, u8 *a)
|
||||
static void elt_square_to_wide(u8 *d, const u8 *a)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
|
@ -152,7 +140,7 @@ static void wide_reduce(u8 *d)
|
|||
d[30] &= 1;
|
||||
}
|
||||
|
||||
static void elt_square(u8 *d, u8 *a)
|
||||
static void elt_square(u8 *d, const u8 *a)
|
||||
{
|
||||
u8 wide[60];
|
||||
|
||||
|
@ -162,7 +150,7 @@ static void elt_square(u8 *d, u8 *a)
|
|||
elt_copy(d, wide + 30);
|
||||
}
|
||||
|
||||
static void itoh_tsujii(u8 *d, u8 *a, u8 *b, u32 j)
|
||||
static void itoh_tsujii(u8 *d, const u8 *a, const u8 *b, u32 j)
|
||||
{
|
||||
u8 t[30];
|
||||
|
||||
|
@ -175,7 +163,7 @@ static void itoh_tsujii(u8 *d, u8 *a, u8 *b, u32 j)
|
|||
elt_mul(d, t, b);
|
||||
}
|
||||
|
||||
static void elt_inv(u8 *d, u8 *a)
|
||||
static void elt_inv(u8 *d, const u8 *a)
|
||||
{
|
||||
u8 t[30];
|
||||
u8 s[30];
|
||||
|
@ -193,7 +181,7 @@ static void elt_inv(u8 *d, u8 *a)
|
|||
elt_square(d, s);
|
||||
}
|
||||
|
||||
/*static int point_is_on_curve(u8 *p)
|
||||
UNUSED static int point_is_on_curve(u8 *p)
|
||||
{
|
||||
u8 s[30], t[30];
|
||||
u8 *x, *y;
|
||||
|
@ -216,16 +204,17 @@ static void elt_inv(u8 *d, u8 *a)
|
|||
|
||||
return elt_is_zero(s);
|
||||
}
|
||||
*/
|
||||
static int point_is_zero(u8 *p)
|
||||
|
||||
static int point_is_zero(const u8 *p)
|
||||
{
|
||||
return elt_is_zero(p) && elt_is_zero(p + 30);
|
||||
}
|
||||
|
||||
static void point_double(u8 *r, u8 *p)
|
||||
static void point_double(u8 *r, const u8 *p)
|
||||
{
|
||||
u8 s[30], t[30];
|
||||
u8 *px, *py, *rx, *ry;
|
||||
const u8 *px, *py;
|
||||
u8 *rx, *ry;
|
||||
|
||||
px = p;
|
||||
py = p + 30;
|
||||
|
@ -254,10 +243,11 @@ static void point_double(u8 *r, u8 *p)
|
|||
elt_add(ry, ry, t);
|
||||
}
|
||||
|
||||
static void point_add(u8 *r, u8 *p, u8 *q)
|
||||
static void point_add(u8 *r, const u8 *p, const u8 *q)
|
||||
{
|
||||
u8 s[30], t[30], u[30];
|
||||
u8 *px, *py, *qx, *qy, *rx, *ry;
|
||||
const u8 *px, *py, *qx, *qy;
|
||||
u8 *rx, *ry;
|
||||
|
||||
px = p;
|
||||
py = p + 30;
|
||||
|
@ -307,7 +297,7 @@ static void point_add(u8 *r, u8 *p, u8 *q)
|
|||
elt_add(ry, s, rx);
|
||||
}
|
||||
|
||||
void point_mul(u8 *d, const u8 *a, u8 *b) // a is bignum
|
||||
void point_mul(u8 *d, const u8 *a, const u8 *b) // a is bignum
|
||||
{
|
||||
u32 i;
|
||||
u8 mask;
|
||||
|
@ -323,7 +313,7 @@ void point_mul(u8 *d, const u8 *a, u8 *b) // a is bignum
|
|||
}
|
||||
}
|
||||
|
||||
void silly_random(u8 * rndArea, u8 count)
|
||||
static void silly_random(u8 * rndArea, u8 count)
|
||||
{
|
||||
u16 i;
|
||||
srand((unsigned) (time(NULL)));
|
||||
|
@ -334,7 +324,7 @@ void silly_random(u8 * rndArea, u8 count)
|
|||
}
|
||||
}
|
||||
|
||||
void generate_ecdsa(u8 *R, u8 *S, const u8 *k, u8 *hash)
|
||||
void generate_ecdsa(u8 *R, u8 *S, const u8 *k, const u8 *hash)
|
||||
{
|
||||
u8 e[30];
|
||||
u8 kk[30];
|
||||
|
@ -372,7 +362,7 @@ void generate_ecdsa(u8 *R, u8 *S, const u8 *k, u8 *hash)
|
|||
bn_mul(S, minv, kk, ec_N, 30);
|
||||
}
|
||||
|
||||
int check_ecdsa(u8 *Q, u8 *R, u8 *S, u8 *hash)
|
||||
UNUSED static int check_ecdsa(u8 *Q, u8 *R, u8 *S, const u8 *hash)
|
||||
{
|
||||
u8 Sinv[30];
|
||||
u8 e[30];
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2007,2008 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
// Licensed under the terms of the GNU GPL, version 2
|
||||
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
void point_mul(u8 *d, const u8 *a, const u8 *b);
|
||||
|
||||
void generate_ecdsa(u8 *R, u8 *S, const u8 *k, const u8 *hash);
|
||||
|
||||
void ec_priv_to_pub(const u8 *k, u8 *Q);
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright 2007,2008 Segher Boessenkool <segher@kernel.crashing.org>
|
||||
// Licensed under the terms of the GNU GPL, version 2
|
||||
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
|
||||
#ifndef _TOOLS_H
|
||||
#define _TOOLS_H
|
||||
#include <polarssl/sha1.h>
|
||||
|
||||
// bignum
|
||||
int bn_compare(u8 *a, u8 *b, u32 n);
|
||||
void bn_sub_modulus(u8 *a, u8 *N, u32 n);
|
||||
void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
||||
void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
||||
void bn_inv(u8 *d, u8 *a, u8 *N, u32 n); // only for prime N
|
||||
void bn_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en);
|
||||
void point_mul(u8 *d, const u8 *a, u8 *b);
|
||||
|
||||
void generate_ecdsa(u8 *R, u8 *S, const u8 *k, u8 *hash);
|
||||
|
||||
void ec_priv_to_pub(const u8 *k, u8 *Q);
|
||||
|
||||
#endif
|
|
@ -362,8 +362,6 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
|||
{
|
||||
STACKFRAME callStack;
|
||||
BOOL bResult;
|
||||
TCHAR symInfo[BUFFERSIZE] = _T("?");
|
||||
TCHAR srcInfo[BUFFERSIZE] = _T("?");
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
// If it's not this thread, let's suspend it, and resume it at the end
|
||||
|
|
|
@ -11,20 +11,20 @@ namespace FPURoundMode
|
|||
enum RoundModes
|
||||
{
|
||||
ROUND_NEAR = 0,
|
||||
ROUND_CHOP,
|
||||
ROUND_UP,
|
||||
ROUND_DOWN
|
||||
ROUND_CHOP = 1,
|
||||
ROUND_UP = 2,
|
||||
ROUND_DOWN = 3
|
||||
};
|
||||
enum PrecisionModes {
|
||||
PREC_24 = 0,
|
||||
PREC_53,
|
||||
PREC_64
|
||||
PREC_53 = 1,
|
||||
PREC_64 = 2
|
||||
};
|
||||
void SetRoundMode(u32 mode);
|
||||
void SetRoundMode(RoundModes mode);
|
||||
|
||||
void SetPrecisionMode(u32 mode);
|
||||
void SetPrecisionMode(PrecisionModes mode);
|
||||
|
||||
void SetSIMDMode(u32 roundingMode, u32 nonIEEEMode);
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode);
|
||||
|
||||
/*
|
||||
* There are two different flavors of float to int conversion:
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
// Generic, do nothing
|
||||
namespace FPURoundMode
|
||||
{
|
||||
void SetRoundMode(u32 mode)
|
||||
void SetRoundMode(RoundModes mode)
|
||||
{
|
||||
}
|
||||
void SetPrecisionMode(u32 mode)
|
||||
void SetPrecisionMode(PrecisionModes mode)
|
||||
{
|
||||
}
|
||||
void SetSIMDMode(u32 mode, u32 nonIEEEMode)
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
|
||||
{
|
||||
}
|
||||
void SaveSIMDState()
|
||||
|
|
|
@ -124,13 +124,12 @@ bool IniFile::Section::Get(const std::string& key, std::vector<std::string>& out
|
|||
}
|
||||
// ignore starting , if any
|
||||
size_t subStart = temp.find_first_not_of(",");
|
||||
size_t subEnd;
|
||||
|
||||
// split by ,
|
||||
while (subStart != std::string::npos)
|
||||
{
|
||||
// Find next ,
|
||||
subEnd = temp.find_first_of(",", subStart);
|
||||
size_t subEnd = temp.find_first_of(",", subStart);
|
||||
if (subStart != subEnd)
|
||||
// take from first char until next ,
|
||||
out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
|
||||
|
|
|
@ -36,7 +36,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
|
|||
return fd;
|
||||
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
|
|
|
@ -1,199 +1,198 @@
|
|||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include "Common/StringUtil.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
#include <unistd.h>
|
||||
#define PAGE_MASK (getpagesize() - 1)
|
||||
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
|
||||
#endif
|
||||
|
||||
// This is purposely not a full wrapper for virtualalloc/mmap, but it
|
||||
// provides exactly the primitive operations that Dolphin needs.
|
||||
|
||||
void* AllocateExecutableMemory(size_t size, bool low)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
static char *map_hint = 0;
|
||||
#if defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
// This OS has no flag to enforce allocation below the 4 GB boundary,
|
||||
// but if we hint that we want a low address it is very likely we will
|
||||
// get one.
|
||||
// An older version of this code used MAP_FIXED, but that has the side
|
||||
// effect of discarding already mapped pages that happen to be in the
|
||||
// requested virtual memory range (such as the emulated RAM, sometimes).
|
||||
if (low && (!map_hint))
|
||||
map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */
|
||||
#endif
|
||||
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_ANON | MAP_PRIVATE
|
||||
#if defined(__x86_64__) && defined(MAP_32BIT)
|
||||
| (low ? MAP_32BIT : 0)
|
||||
#endif
|
||||
, -1, 0);
|
||||
#endif /* defined(_WIN32) */
|
||||
|
||||
// printf("Mapped executable memory at %p (size %ld)\n", ptr,
|
||||
// (unsigned long)size);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
if (ptr == MAP_FAILED)
|
||||
{
|
||||
ptr = NULL;
|
||||
#else
|
||||
if (ptr == NULL)
|
||||
{
|
||||
#endif
|
||||
PanicAlert("Failed to allocate executable memory");
|
||||
}
|
||||
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
else
|
||||
{
|
||||
if (low)
|
||||
{
|
||||
map_hint += size;
|
||||
map_hint = (char*)round_page(map_hint); /* round up to the next page */
|
||||
// printf("Next map will (hopefully) be at %p\n", map_hint);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_M_X64)
|
||||
if ((u64)ptr >= 0x80000000 && low == true)
|
||||
PanicAlert("Executable memory ended up above 2GB!");
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* AllocateMemoryPages(size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
#else
|
||||
void* ptr = mmap(0, size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
|
||||
// printf("Mapped memory at %p (size %ld)\n", ptr,
|
||||
// (unsigned long)size);
|
||||
|
||||
if (ptr == NULL)
|
||||
PanicAlert("Failed to allocate raw memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* AllocateAlignedMemory(size_t size,size_t alignment)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void* ptr = _aligned_malloc(size,alignment);
|
||||
#else
|
||||
void* ptr = NULL;
|
||||
#ifdef ANDROID
|
||||
ptr = memalign(alignment, size);
|
||||
#else
|
||||
if (posix_memalign(&ptr, alignment, size) != 0)
|
||||
ERROR_LOG(MEMMAP, "Failed to allocate aligned memory");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// printf("Mapped memory at %p (size %ld)\n", ptr,
|
||||
// (unsigned long)size);
|
||||
|
||||
if (ptr == NULL)
|
||||
PanicAlert("Failed to allocate aligned memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void FreeMemoryPages(void* ptr, size_t size)
|
||||
{
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||
ptr = NULL; // Is this our responsibility?
|
||||
|
||||
#else
|
||||
munmap(ptr, size);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void FreeAlignedMemory(void* ptr)
|
||||
{
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_aligned_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
||||
PanicAlert("WriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
#else
|
||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
|
||||
PanicAlert("UnWriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
#else
|
||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string MemUsage()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib, "psapi")
|
||||
DWORD processID = GetCurrentProcessId();
|
||||
HANDLE hProcess;
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
std::string Ret;
|
||||
|
||||
// Print information about the memory usage of the process.
|
||||
|
||||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID);
|
||||
if (NULL == hProcess) return "MemUsage Error";
|
||||
|
||||
if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
|
||||
Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());
|
||||
|
||||
CloseHandle(hProcess);
|
||||
return Ret;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#include "Common/StringUtil.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
#include <unistd.h>
|
||||
#define PAGE_MASK (getpagesize() - 1)
|
||||
#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
|
||||
#endif
|
||||
|
||||
// This is purposely not a full wrapper for virtualalloc/mmap, but it
|
||||
// provides exactly the primitive operations that Dolphin needs.
|
||||
|
||||
void* AllocateExecutableMemory(size_t size, bool low)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
static char *map_hint = 0;
|
||||
#if defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
// This OS has no flag to enforce allocation below the 4 GB boundary,
|
||||
// but if we hint that we want a low address it is very likely we will
|
||||
// get one.
|
||||
// An older version of this code used MAP_FIXED, but that has the side
|
||||
// effect of discarding already mapped pages that happen to be in the
|
||||
// requested virtual memory range (such as the emulated RAM, sometimes).
|
||||
if (low && (!map_hint))
|
||||
map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */
|
||||
#endif
|
||||
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_ANON | MAP_PRIVATE
|
||||
#if defined(__x86_64__) && defined(MAP_32BIT)
|
||||
| (low ? MAP_32BIT : 0)
|
||||
#endif
|
||||
, -1, 0);
|
||||
#endif /* defined(_WIN32) */
|
||||
|
||||
// printf("Mapped executable memory at %p (size %ld)\n", ptr,
|
||||
// (unsigned long)size);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
if (ptr == MAP_FAILED)
|
||||
{
|
||||
ptr = NULL;
|
||||
#else
|
||||
if (ptr == NULL)
|
||||
{
|
||||
#endif
|
||||
PanicAlert("Failed to allocate executable memory");
|
||||
}
|
||||
#if !defined(_WIN32) && defined(__x86_64__) && !defined(MAP_32BIT)
|
||||
else
|
||||
{
|
||||
if (low)
|
||||
{
|
||||
map_hint += size;
|
||||
map_hint = (char*)round_page(map_hint); /* round up to the next page */
|
||||
// printf("Next map will (hopefully) be at %p\n", map_hint);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_M_X64)
|
||||
if ((u64)ptr >= 0x80000000 && low == true)
|
||||
PanicAlert("Executable memory ended up above 2GB!");
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* AllocateMemoryPages(size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
#else
|
||||
void* ptr = mmap(0, size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
#endif
|
||||
|
||||
// printf("Mapped memory at %p (size %ld)\n", ptr,
|
||||
// (unsigned long)size);
|
||||
|
||||
if (ptr == NULL)
|
||||
PanicAlert("Failed to allocate raw memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* AllocateAlignedMemory(size_t size,size_t alignment)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
void* ptr = _aligned_malloc(size,alignment);
|
||||
#else
|
||||
void* ptr = NULL;
|
||||
#ifdef ANDROID
|
||||
ptr = memalign(alignment, size);
|
||||
#else
|
||||
if (posix_memalign(&ptr, alignment, size) != 0)
|
||||
ERROR_LOG(MEMMAP, "Failed to allocate aligned memory");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// printf("Mapped memory at %p (size %ld)\n", ptr,
|
||||
// (unsigned long)size);
|
||||
|
||||
if (ptr == NULL)
|
||||
PanicAlert("Failed to allocate aligned memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void FreeMemoryPages(void* ptr, size_t size)
|
||||
{
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||
{
|
||||
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||
}
|
||||
#else
|
||||
munmap(ptr, size);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void FreeAlignedMemory(void* ptr)
|
||||
{
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_aligned_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
||||
PanicAlert("WriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
#else
|
||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
|
||||
PanicAlert("UnWriteProtectMemory failed!\n%s", GetLastErrorMsg());
|
||||
#else
|
||||
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string MemUsage()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib, "psapi")
|
||||
DWORD processID = GetCurrentProcessId();
|
||||
HANDLE hProcess;
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
std::string Ret;
|
||||
|
||||
// Print information about the memory usage of the process.
|
||||
|
||||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID);
|
||||
if (NULL == hProcess) return "MemUsage Error";
|
||||
|
||||
if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
|
||||
Ret = StringFromFormat("%s K", ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str());
|
||||
|
||||
CloseHandle(hProcess);
|
||||
return Ret;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -4,30 +4,21 @@
|
|||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/FPURoundMode.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
static const unsigned short FPU_ROUND_NEAR = 0 << 10;
|
||||
static const unsigned short FPU_ROUND_DOWN = 1 << 10;
|
||||
static const unsigned short FPU_ROUND_UP = 2 << 10;
|
||||
static const unsigned short FPU_ROUND_CHOP = 3 << 10;
|
||||
static const unsigned short FPU_ROUND_MASK = 3 << 10;
|
||||
#include <xmmintrin.h>
|
||||
#ifdef _WIN32
|
||||
# include <mmintrin.h>
|
||||
#else
|
||||
# include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
|
||||
static const u32 EXCEPTION_MASK = 0x1F80;
|
||||
// Denormals-Are-Zero (non-IEEE mode: denormal inputs are set to +/- 0)
|
||||
static const u32 DAZ = 0x40;
|
||||
// Flush-To-Zero (non-IEEE mode: denormal outputs are set to +/- 0)
|
||||
static const u32 FTZ = 0x8000;
|
||||
|
||||
namespace FPURoundMode
|
||||
{
|
||||
// Get the default SSE states here.
|
||||
static u32 saved_sse_state = _mm_getcsr();
|
||||
static const u32 default_sse_state = _mm_getcsr();
|
||||
|
||||
void SetRoundMode(u32 mode)
|
||||
void SetRoundMode(RoundModes mode)
|
||||
{
|
||||
// Set FPU rounding mode to mimic the PowerPC's
|
||||
#ifdef _M_IX86
|
||||
|
@ -42,22 +33,23 @@ namespace FPURoundMode
|
|||
};
|
||||
_set_controlfp(_MCW_RC, table[mode]);
|
||||
#else
|
||||
const unsigned short table[4] =
|
||||
const unsigned short X87_ROUND_MASK = 3 << 10;
|
||||
const unsigned short x87_rounding_table[] =
|
||||
{
|
||||
FPU_ROUND_NEAR,
|
||||
FPU_ROUND_CHOP,
|
||||
FPU_ROUND_UP,
|
||||
FPU_ROUND_DOWN
|
||||
0 << 10, // nearest
|
||||
3 << 10, // zero
|
||||
2 << 10, // +inf
|
||||
1 << 10, // -inf
|
||||
};
|
||||
unsigned short _mode;
|
||||
asm ("fstcw %0" : "=m" (_mode) : );
|
||||
_mode = (_mode & ~FPU_ROUND_MASK) | table[mode];
|
||||
asm ("fstcw %0" : "=m" (_mode));
|
||||
_mode = (_mode & ~X87_ROUND_MASK) | x87_rounding_table[mode];
|
||||
asm ("fldcw %0" : : "m" (_mode));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetPrecisionMode(u32 mode)
|
||||
void SetPrecisionMode(PrecisionModes mode)
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
// sets the floating-point lib to 53-bit
|
||||
|
@ -66,15 +58,15 @@ namespace FPURoundMode
|
|||
#ifdef _WIN32
|
||||
_control87(_PC_53, MCW_PC);
|
||||
#else
|
||||
const unsigned short table[4] = {
|
||||
0 << 8, // FPU_PREC_24
|
||||
2 << 8, // FPU_PREC_53
|
||||
3 << 8, // FPU_PREC_64
|
||||
3 << 8, // FPU_PREC_MASK
|
||||
const unsigned short PRECISION_MASK = 3 << 8;
|
||||
const unsigned short precision_table[] = {
|
||||
0 << 8, // 24 bits
|
||||
2 << 8, // 53 bits
|
||||
3 << 8, // 64 bits
|
||||
};
|
||||
unsigned short _mode;
|
||||
asm ("fstcw %0" : "=m" (_mode));
|
||||
_mode = (_mode & ~table[3]) | table[mode];
|
||||
_mode = (_mode & ~PRECISION_MASK) | precision_table[mode];
|
||||
asm ("fldcw %0" : : "m" (_mode));
|
||||
#endif
|
||||
#else
|
||||
|
@ -83,24 +75,32 @@ namespace FPURoundMode
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetSIMDMode(u32 roundingMode, u32 nonIEEEMode)
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
|
||||
{
|
||||
// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
|
||||
const u32 EXCEPTION_MASK = 0x1F80;
|
||||
// Denormals-Are-Zero (non-IEEE mode: denormal inputs are set to +/- 0)
|
||||
const u32 DAZ = 0x40;
|
||||
// Flush-To-Zero (non-IEEE mode: denormal outputs are set to +/- 0)
|
||||
const u32 FTZ = 0x8000;
|
||||
// lookup table for FPSCR.RN-to-MXCSR.RC translation
|
||||
static const u32 roundingModeLUT[4] =
|
||||
static const u32 simd_rounding_table[] =
|
||||
{
|
||||
(0 << 13) | EXCEPTION_MASK, // nearest
|
||||
(3 << 13) | EXCEPTION_MASK, // -inf
|
||||
(2 << 13) | EXCEPTION_MASK, // +inf
|
||||
(1 << 13) | EXCEPTION_MASK, // zero
|
||||
};
|
||||
u32 csr = roundingModeLUT[roundingMode];
|
||||
u32 csr = simd_rounding_table[rounding_mode];
|
||||
|
||||
// Some initial steppings of Pentium 4 CPUs support FTZ but not DAZ.
|
||||
// They will not flush input operands but flushing outputs only is better than nothing.
|
||||
static const u32 denormalLUT[2] =
|
||||
{
|
||||
FTZ, // flush-to-zero only
|
||||
FTZ | DAZ, // flush-to-zero and denormals-are-zero (may not be supported)
|
||||
};
|
||||
if (nonIEEEMode)
|
||||
if (non_ieee_mode)
|
||||
{
|
||||
csr |= denormalLUT[cpu_info.bFlushToZero];
|
||||
}
|
||||
|
|
|
@ -22,11 +22,6 @@ const char *filter = "0123456789ABCDEFGHJKMNPQRTUVWXYZILOS";
|
|||
|
||||
u32 genseeds[0x20];
|
||||
|
||||
|
||||
const u8 bitstringlen[0x08] = {
|
||||
0x06, 0x0A, 0x0C, 0x11, 0x11, 0x08, 0x07, 0x20,
|
||||
};
|
||||
|
||||
const u8 gentable0[0x38] = {
|
||||
0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01,
|
||||
0x3A, 0x32, 0x2A, 0x22, 0x1A, 0x12, 0x0A, 0x02,
|
||||
|
@ -150,51 +145,56 @@ const u32 table7[0x40] = {
|
|||
|
||||
void generateseeds(u32 *seeds, const u8 *seedtable, u8 doreverse)
|
||||
{
|
||||
int i,j;
|
||||
u32 tmp3;
|
||||
u8 array0[0x38],array1[0x38],array2[0x08];
|
||||
u8 tmp,tmp2;
|
||||
|
||||
i = 0;
|
||||
while (i < 0x38)
|
||||
for (int i = 0; i < 0x38; ++i)
|
||||
{
|
||||
tmp = (gentable0[i] - 1);
|
||||
array0[i++] = ((u32)(0-(seedtable[tmp>>3] & gentable1[tmp&7])) >> 31);
|
||||
array0[i] = ((u32)(0-(seedtable[tmp>>3] & gentable1[tmp&7])) >> 31);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (i < 0x10)
|
||||
for (int i = 0; i < 0x10; ++i)
|
||||
{
|
||||
memset(array2,0,8);
|
||||
tmp2 = gentable2[i];
|
||||
|
||||
for (j = 0; j < 0x38; j++)
|
||||
for (int j = 0; j < 0x38; j++)
|
||||
{
|
||||
tmp = (tmp2+j);
|
||||
|
||||
if (j > 0x1B)
|
||||
{
|
||||
if (tmp > 0x37) tmp-=0x1C;
|
||||
if (tmp > 0x37)
|
||||
{
|
||||
tmp-=0x1C;
|
||||
}
|
||||
}
|
||||
else if (tmp > 0x1B)
|
||||
{
|
||||
tmp-=0x1C;
|
||||
}
|
||||
else if (tmp > 0x1B) tmp-=0x1C;
|
||||
|
||||
array1[j] = array0[tmp];
|
||||
}
|
||||
for (j = 0; j < 0x30; j++)
|
||||
for (int j = 0; j < 0x30; j++)
|
||||
{
|
||||
if (!array1[gentable3[j]-1]) continue;
|
||||
if (!array1[gentable3[j]-1])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
tmp = (((j*0x2AAB)>>16) - (j>>0x1F));
|
||||
array2[tmp] |= (gentable1[j-(tmp*6)]>>2);
|
||||
}
|
||||
seeds[i<<1] = ((array2[0]<<24)|(array2[2]<<16)|(array2[4]<<8)|array2[6]);
|
||||
seeds[(i<<1)+1] = ((array2[1]<<24)|(array2[3]<<16)|(array2[5]<<8)|array2[7]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!doreverse)
|
||||
{
|
||||
j = 0x1F;
|
||||
for (i = 0; i < 16; i+=2)
|
||||
int j = 0x1F;
|
||||
for (int i = 0; i < 16; i+=2)
|
||||
{
|
||||
tmp3 = seeds[i];
|
||||
seeds[i] = seeds[j-1];
|
||||
|
@ -227,20 +227,17 @@ void setcode(u32 *dst, u32 addr, u32 val)
|
|||
|
||||
u16 gencrc16(u32 *codes, u16 size)
|
||||
{
|
||||
u16 ret=0;
|
||||
u8 tmp=0,tmp2;
|
||||
int i;
|
||||
u16 ret = 0;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
while (tmp < size)
|
||||
for (u8 tmp = 0; tmp < size; ++tmp)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
tmp2 = ((codes[tmp] >> (i<<3))^ret);
|
||||
u8 tmp2 = ((codes[tmp] >> (i<<3))^ret);
|
||||
ret = ((crctable0[(tmp2>>4)&0x0F]^crctable1[tmp2&0x0F])^(ret>>8));
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -248,9 +245,7 @@ u16 gencrc16(u32 *codes, u16 size)
|
|||
|
||||
u8 verifycode(u32 *codes, u16 size)
|
||||
{
|
||||
u16 tmp;
|
||||
|
||||
tmp = gencrc16(codes,size);
|
||||
u16 tmp = gencrc16(codes,size);
|
||||
return (((tmp>>12)^(tmp>>8)^(tmp>>4)^tmp)&0x0F);
|
||||
}
|
||||
|
||||
|
@ -343,7 +338,10 @@ bool getbitstring(u32 *ctrl, u32 *out, u8 len)
|
|||
ctrl[1]++;
|
||||
tmp = (ctrl[0]+(ctrl[1]<<2));
|
||||
}
|
||||
if (ctrl[1] >= ctrl[3]) return false;
|
||||
if (ctrl[1] >= ctrl[3])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*out = ((*out<<1) | ((tmp >> (0x1F-ctrl[2])) & 1));
|
||||
ctrl[2]++;
|
||||
}
|
||||
|
@ -377,13 +375,16 @@ bool batchdecrypt(u32 *codes, u16 size)
|
|||
getbitstring(tmparray,tmparray2+5,2); // Region
|
||||
|
||||
// Grab gameid and region from the last decrypted code
|
||||
// Maybe check this against dolphin's GameID? - "code is for wrong game" type msg
|
||||
// TODO: Maybe check this against dolphin's GameID? - "code is for wrong game" type msg
|
||||
//gameid = tmparray2[1];
|
||||
//region = tmparray2[5];
|
||||
|
||||
tmp = codes[0];
|
||||
codes[0] &= 0x0FFFFFFF;
|
||||
if ((tmp>>28) != verifycode(codes,size)) return false;
|
||||
if ((tmp>>28) != verifycode(codes,size))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -411,23 +412,24 @@ int GetVal(const char *flt, char chr)
|
|||
|
||||
int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
|
||||
{
|
||||
int i,j=0,k;
|
||||
int ret=0,org=(size+1);
|
||||
int j = 0;
|
||||
int ret = 0;
|
||||
int org = size + 1;
|
||||
u32 bin[2];
|
||||
u8 parity;
|
||||
|
||||
while (size)
|
||||
for (; size; --size)
|
||||
{
|
||||
bin[0]=0;
|
||||
for (i = 0; i < 6; i++)
|
||||
bin[0] = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
bin[0] |= (GetVal(filter,alpha[j>>1][i]) << (((5-i)*5)+2));
|
||||
}
|
||||
bin[0] |= (GetVal(filter,alpha[j>>1][6]) >> 3);
|
||||
dst[j++] = bin[0];
|
||||
|
||||
bin[1]=0;
|
||||
for (i = 0; i < 6; i++)
|
||||
bin[1] = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
bin[1] |= (GetVal(filter,alpha[j>>1][i+6]) << (((5-i)*5)+4));
|
||||
}
|
||||
|
@ -435,16 +437,20 @@ int alphatobin(u32 *dst, std::vector<std::string> alpha, int size)
|
|||
dst[j++] = bin[1];
|
||||
|
||||
//verify parity bit
|
||||
k=0;
|
||||
parity=0;
|
||||
for (i = 0; i < 64; i++)
|
||||
int k = 0;
|
||||
parity = 0;
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
if (i == 32) k++;
|
||||
if (i == 32)
|
||||
{
|
||||
k++;
|
||||
}
|
||||
parity ^= (bin[k] >> (i-(k<<5)));
|
||||
}
|
||||
if ((parity&1) != (GetVal(filter,alpha[(j-2)>>1][12])&1)) ret=(org-size);
|
||||
|
||||
size--;
|
||||
if ((parity&1) != (GetVal(filter,alpha[(j-2)>>1][12])&1))
|
||||
{
|
||||
ret=(org-size);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -456,12 +462,11 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
|
|||
buildseeds();
|
||||
|
||||
u32 uCodes[1200];
|
||||
u32 i,ret;
|
||||
u32 ret;
|
||||
|
||||
for(i = 0; i < vCodes.size(); ++i)
|
||||
for (std::string& s : vCodes)
|
||||
{
|
||||
transform(vCodes[i].begin(), vCodes[i].end(), vCodes[i].begin(), toupper);
|
||||
//PanicAlert("Encrypted AR Code\n%s", vCodes[i].c_str());
|
||||
std::transform(s.begin(), s.end(), s.begin(), toupper);
|
||||
}
|
||||
|
||||
if ((ret=alphatobin(uCodes, vCodes, (int)vCodes.size())))
|
||||
|
@ -475,7 +480,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
|
|||
//PanicAlert("Action Replay Code Decryption Error:\nCRC Check Failed\n\n"
|
||||
// "First Code in Block(should be verification code):\n%s", vCodes[0].c_str());
|
||||
|
||||
for (i = 0; i < (vCodes.size()<<1); i+=2)
|
||||
for (size_t i = 0; i < (vCodes.size()<<1); i+=2)
|
||||
{
|
||||
AREntry op;
|
||||
op.cmd_addr = uCodes[i];
|
||||
|
@ -487,7 +492,7 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry> &ops)
|
|||
else
|
||||
{
|
||||
// Skip passing the verification code back
|
||||
for (i = 2; i < (vCodes.size()<<1); i+=2)
|
||||
for (size_t i = 2; i < (vCodes.size()<<1); i+=2)
|
||||
{
|
||||
AREntry op;
|
||||
op.cmd_addr = uCodes[i];
|
||||
|
|
|
@ -100,14 +100,14 @@ struct ARAddr
|
|||
};
|
||||
|
||||
void LogInfo(const char *format, ...);
|
||||
bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data);
|
||||
bool Subtype_WriteToPointer(const ARAddr addr, const u32 data);
|
||||
bool Subtype_AddCode(const ARAddr addr, const u32 data);
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data);
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data);
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data);
|
||||
bool NormalCode(const ARAddr addr, const u32 data);
|
||||
bool ConditionalCode(const ARAddr addr, const u32 data, int* const pSkipCount);
|
||||
bool Subtype_RamWriteAndFill(const ARAddr& addr, const u32 data);
|
||||
bool Subtype_WriteToPointer(const ARAddr& addr, const u32 data);
|
||||
bool Subtype_AddCode(const ARAddr& addr, const u32 data);
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr& addr, const u32 data);
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr& addr, const u32 data);
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u32 data);
|
||||
bool NormalCode(const ARAddr& addr, const u32 data);
|
||||
bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkipCount);
|
||||
bool CompareValues(const u32 val1, const u32 val2, const int type);
|
||||
|
||||
// ----------------------
|
||||
|
@ -487,7 +487,7 @@ bool IsSelfLogging()
|
|||
|
||||
// ----------------------
|
||||
// Code Functions
|
||||
bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data)
|
||||
bool Subtype_RamWriteAndFill(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
|
||||
|
@ -544,7 +544,7 @@ bool Subtype_RamWriteAndFill(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Subtype_WriteToPointer(const ARAddr addr, const u32 data)
|
||||
bool Subtype_WriteToPointer(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
const u32 ptr = Memory::Read_U32(new_addr);
|
||||
|
@ -603,7 +603,7 @@ bool Subtype_WriteToPointer(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Subtype_AddCode(const ARAddr addr, const u32 data)
|
||||
bool Subtype_AddCode(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
// Used to increment/decrement a value in memory
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
|
@ -663,7 +663,7 @@ bool Subtype_AddCode(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data)
|
||||
bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
// code not yet implemented - TODO
|
||||
// u32 new_addr = (addr & 0x01FFFFFF) | 0x80000000;
|
||||
|
@ -675,7 +675,7 @@ bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr addr, const u32 data)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data) // This needs more testing
|
||||
bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr& addr, const u32 data) // This needs more testing
|
||||
{
|
||||
const u32 new_addr = ((ARAddr*)&val_last)->GCAddress();
|
||||
const u8 size = ((ARAddr*)&val_last)->size;
|
||||
|
@ -750,7 +750,7 @@ bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data
|
|||
}
|
||||
|
||||
// Looks like this is new?? - untested
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data)
|
||||
bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u32 data)
|
||||
{
|
||||
const u32 addr_dest = val_last | 0x06000000;
|
||||
const u32 addr_src = addr.GCAddress();
|
||||
|
@ -796,7 +796,7 @@ bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool NormalCode(const ARAddr addr, const u32 data)
|
||||
bool NormalCode(const ARAddr& addr, const u32 data)
|
||||
{
|
||||
switch (addr.subtype)
|
||||
{
|
||||
|
@ -834,7 +834,7 @@ bool NormalCode(const ARAddr addr, const u32 data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ConditionalCode(const ARAddr addr, const u32 data, int* const pSkipCount)
|
||||
bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkipCount)
|
||||
{
|
||||
const u32 new_addr = addr.GCAddress();
|
||||
|
||||
|
|
|
@ -392,7 +392,6 @@ bool CBoot::EmulatedBS2_Wii()
|
|||
Memory::Write_U32(firmwareVer ? firmwareVer : 0x00090204, 0x00003140);
|
||||
|
||||
// Load patches and run startup patches
|
||||
std::string gameID = VolumeHandler::GetVolume()->GetUniqueID();
|
||||
PatchEngine::LoadPatches();
|
||||
|
||||
// return
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace BootManager
|
|||
struct ConfigCache
|
||||
{
|
||||
bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
|
||||
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bTLBHack, bUseFPS;
|
||||
bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bTLBHack;
|
||||
int iCPUCore, Volume;
|
||||
int iWiimoteSource[MAX_BBMOTES];
|
||||
SIDevices Pads[MAX_SI_CHANNELS];
|
||||
|
@ -109,7 +109,7 @@ bool BootCore(const std::string& _rFilename)
|
|||
config_cache.bDSPHLE = StartUp.bDSPHLE;
|
||||
config_cache.strBackend = StartUp.m_strVideoBackend;
|
||||
config_cache.bHLE_BS2 = StartUp.bHLE_BS2;
|
||||
config_cache.m_EnableJIT = SConfig::GetInstance().m_EnableJIT;
|
||||
config_cache.m_EnableJIT = SConfig::GetInstance().m_DSPEnableJIT;
|
||||
config_cache.bDSPThread = StartUp.bDSPThread;
|
||||
config_cache.Volume = SConfig::GetInstance().m_Volume;
|
||||
config_cache.sBackend = SConfig::GetInstance().sBackend;
|
||||
|
@ -158,7 +158,7 @@ bool BootCore(const std::string& _rFilename)
|
|||
}
|
||||
if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume))
|
||||
config_cache.bSetVolume = true;
|
||||
game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT);
|
||||
game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_DSPEnableJIT, SConfig::GetInstance().m_DSPEnableJIT);
|
||||
game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend);
|
||||
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
|
||||
|
||||
|
@ -223,7 +223,7 @@ bool BootCore(const std::string& _rFilename)
|
|||
StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE;
|
||||
StartUp.bEnableMemcardSaving = g_NetPlaySettings.m_WriteToMemcard;
|
||||
StartUp.iCPUCore = g_NetPlaySettings.m_CPUcore;
|
||||
SConfig::GetInstance().m_EnableJIT = g_NetPlaySettings.m_DSPEnableJIT;
|
||||
SConfig::GetInstance().m_DSPEnableJIT = g_NetPlaySettings.m_DSPEnableJIT;
|
||||
SConfig::GetInstance().m_EXIDevice[0] = g_NetPlaySettings.m_EXIDevice[0];
|
||||
SConfig::GetInstance().m_EXIDevice[1] = g_NetPlaySettings.m_EXIDevice[1];
|
||||
config_cache.bSetEXIDevice[0] = true;
|
||||
|
@ -268,7 +268,7 @@ void Stop()
|
|||
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
|
||||
StartUp.bHLE_BS2 = config_cache.bHLE_BS2;
|
||||
SConfig::GetInstance().sBackend = config_cache.sBackend;
|
||||
SConfig::GetInstance().m_EnableJIT = config_cache.m_EnableJIT;
|
||||
SConfig::GetInstance().m_DSPEnableJIT = config_cache.m_EnableJIT;
|
||||
|
||||
// Only change these back if they were actually set by game ini, since they can be changed while a game is running.
|
||||
if (config_cache.bSetFramelimit)
|
||||
|
|
|
@ -267,7 +267,7 @@ void SConfig::SaveSettings()
|
|||
ini.Set("Movie", "Author", m_strMovieAuthor);
|
||||
|
||||
// DSP
|
||||
ini.Set("DSP", "EnableJIT", m_EnableJIT);
|
||||
ini.Set("DSP", "EnableJIT", m_DSPEnableJIT);
|
||||
ini.Set("DSP", "DumpAudio", m_DumpAudio);
|
||||
ini.Set("DSP", "Backend", sBackend);
|
||||
ini.Set("DSP", "Volume", m_Volume);
|
||||
|
@ -430,7 +430,7 @@ void SConfig::LoadSettings()
|
|||
ini.Get("Movie", "Author", &m_strMovieAuthor, "");
|
||||
|
||||
// DSP
|
||||
ini.Get("DSP", "EnableJIT", &m_EnableJIT, true);
|
||||
ini.Get("DSP", "EnableJIT", &m_DSPEnableJIT, true);
|
||||
ini.Get("DSP", "DumpAudio", &m_DumpAudio, false);
|
||||
#if defined __linux__ && HAVE_ALSA
|
||||
ini.Get("DSP", "Backend", &sBackend, BACKEND_ALSA);
|
||||
|
|
|
@ -79,7 +79,7 @@ struct SConfig : NonCopyable
|
|||
unsigned int m_FrameSkip;
|
||||
|
||||
// DSP settings
|
||||
bool m_EnableJIT;
|
||||
bool m_DSPEnableJIT;
|
||||
bool m_DumpAudio;
|
||||
int m_Volume;
|
||||
std::string sBackend;
|
||||
|
|
|
@ -134,6 +134,7 @@ static void DSPCore_FreeMemoryPages()
|
|||
FreeMemoryPages(g_dsp.iram, DSP_IRAM_BYTE_SIZE);
|
||||
FreeMemoryPages(g_dsp.dram, DSP_DRAM_BYTE_SIZE);
|
||||
FreeMemoryPages(g_dsp.coef, DSP_COEF_BYTE_SIZE);
|
||||
g_dsp.irom = g_dsp.iram = g_dsp.dram = g_dsp.coef = NULL;
|
||||
}
|
||||
|
||||
bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
|
||||
|
|
|
@ -35,12 +35,18 @@ static void *reg_ptr(int reg)
|
|||
case DSP_REG_ACH0:
|
||||
case DSP_REG_ACH1:
|
||||
return &g_dsp.r.ac[reg - DSP_REG_ACH0].h;
|
||||
case DSP_REG_CR: return &g_dsp.r.cr;
|
||||
case DSP_REG_SR: return &g_dsp.r.sr;
|
||||
case DSP_REG_PRODL: return &g_dsp.r.prod.l;
|
||||
case DSP_REG_PRODM: return &g_dsp.r.prod.m;
|
||||
case DSP_REG_PRODH: return &g_dsp.r.prod.h;
|
||||
case DSP_REG_PRODM2: return &g_dsp.r.prod.m2;
|
||||
case DSP_REG_CR:
|
||||
return &g_dsp.r.cr;
|
||||
case DSP_REG_SR:
|
||||
return &g_dsp.r.sr;
|
||||
case DSP_REG_PRODL:
|
||||
return &g_dsp.r.prod.l;
|
||||
case DSP_REG_PRODM:
|
||||
return &g_dsp.r.prod.m;
|
||||
case DSP_REG_PRODH:
|
||||
return &g_dsp.r.prod.h;
|
||||
case DSP_REG_PRODM2:
|
||||
return &g_dsp.r.prod.m2;
|
||||
case DSP_REG_AXL0:
|
||||
case DSP_REG_AXL1:
|
||||
return &g_dsp.r.ax[reg - DSP_REG_AXL0].l;
|
||||
|
@ -81,24 +87,24 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
|||
xreg.pushed = false;
|
||||
}
|
||||
|
||||
xregs[RAX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
|
||||
xregs[RDX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
|
||||
xregs[RCX].guest_reg = DSP_REG_STATIC;// reserved for shifts
|
||||
xregs[RAX].guest_reg = DSP_REG_STATIC; // reserved for MUL/DIV
|
||||
xregs[RDX].guest_reg = DSP_REG_STATIC; // reserved for MUL/DIV
|
||||
xregs[RCX].guest_reg = DSP_REG_STATIC; // reserved for shifts
|
||||
|
||||
xregs[RBX].guest_reg = DSP_REG_STATIC;//extended op backing store
|
||||
xregs[RBX].guest_reg = DSP_REG_STATIC; // extended op backing store
|
||||
|
||||
xregs[RSP].guest_reg = DSP_REG_STATIC;//stack pointer
|
||||
xregs[RSP].guest_reg = DSP_REG_STATIC; // stack pointer
|
||||
|
||||
xregs[RBP].guest_reg = DSP_REG_NONE;//definitely usable in dsplle because
|
||||
//all external calls are protected
|
||||
xregs[RBP].guest_reg = DSP_REG_NONE; // definitely usable in dsplle because
|
||||
// all external calls are protected
|
||||
|
||||
xregs[RSI].guest_reg = DSP_REG_NONE;
|
||||
xregs[RDI].guest_reg = DSP_REG_NONE;
|
||||
|
||||
#ifdef _M_X64
|
||||
#ifdef STATIC_REG_ACCS
|
||||
xregs[R8].guest_reg = DSP_REG_STATIC;//acc0
|
||||
xregs[R9].guest_reg = DSP_REG_STATIC;//acc1
|
||||
xregs[R8].guest_reg = DSP_REG_STATIC; //acc0
|
||||
xregs[R9].guest_reg = DSP_REG_STATIC; //acc1
|
||||
#else
|
||||
xregs[R8].guest_reg = DSP_REG_NONE;
|
||||
xregs[R9].guest_reg = DSP_REG_NONE;
|
||||
|
@ -121,12 +127,13 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
|||
regs[i].parentReg = DSP_REG_NONE;
|
||||
regs[i].shift = 0;
|
||||
regs[i].host_reg = INVALID_REG;
|
||||
|
||||
regs[i].loc = M(regs[i].mem);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < 32; i++)
|
||||
{
|
||||
regs[i].size = 2;
|
||||
}
|
||||
//special composite registers
|
||||
#ifdef _M_X64
|
||||
#ifdef STATIC_REG_ACCS
|
||||
|
@ -170,8 +177,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
|
|||
DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache &cache)
|
||||
: emitter(cache.emitter), temporary(true), merged(false)
|
||||
{
|
||||
memcpy(xregs,cache.xregs,sizeof(xregs));
|
||||
memcpy(regs,cache.regs,sizeof(regs));
|
||||
memcpy(xregs, cache.xregs, sizeof(xregs));
|
||||
memcpy(regs, cache.regs, sizeof(regs));
|
||||
}
|
||||
|
||||
DSPJitRegCache& DSPJitRegCache::operator=(const DSPJitRegCache &cache)
|
||||
|
@ -179,8 +186,8 @@ DSPJitRegCache& DSPJitRegCache::operator=(const DSPJitRegCache &cache)
|
|||
_assert_msg_(DSPLLE, &emitter == &cache.emitter, "emitter does not match");
|
||||
_assert_msg_(DSPLLE, temporary, "register cache not temporary??");
|
||||
merged = false;
|
||||
memcpy(xregs,cache.xregs,sizeof(xregs));
|
||||
memcpy(regs,cache.regs,sizeof(regs));
|
||||
memcpy(xregs, cache.xregs, sizeof(xregs));
|
||||
memcpy(regs, cache.regs, sizeof(regs));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -199,18 +206,20 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
{
|
||||
cache.merged = true;
|
||||
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
//drop all guest register not used by cache
|
||||
// drop all guest register not used by cache
|
||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
regs[i].used = false;//used is restored later
|
||||
regs[i].used = false; //used is restored later
|
||||
if (regs[i].loc.IsSimpleReg() &&
|
||||
!cache.regs[i].loc.IsSimpleReg())
|
||||
!cache.regs[i].loc.IsSimpleReg())
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
//try to move guest regs in the wrong host reg to the correct one
|
||||
// try to move guest regs in the wrong host reg to the correct one
|
||||
int movcnt;
|
||||
do
|
||||
{
|
||||
|
@ -228,16 +237,18 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
}
|
||||
} while (movcnt != 0);
|
||||
|
||||
//free all host regs that are not used for the same guest reg
|
||||
// free all host regs that are not used for the same guest reg
|
||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (cache.regs[i].loc.GetSimpleReg() !=
|
||||
regs[i].loc.GetSimpleReg() &&
|
||||
regs[i].loc.IsSimpleReg())
|
||||
regs[i].loc.GetSimpleReg() &&
|
||||
regs[i].loc.IsSimpleReg())
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
//load all guest regs that are in memory and should be in host reg
|
||||
// load all guest regs that are in memory and should be in host reg
|
||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (cache.regs[i].loc.IsSimpleReg())
|
||||
|
@ -255,43 +266,48 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
regs[i].last_use_ctr = cache.regs[i].last_use_ctr;
|
||||
}
|
||||
|
||||
//sync the freely used xregs
|
||||
// sync the freely used xregs
|
||||
if (!emit) {
|
||||
for(i = 0; i < NUMXREGS; i++) {
|
||||
for(i = 0; i < NUMXREGS; i++)
|
||||
{
|
||||
if (cache.xregs[i].guest_reg == DSP_REG_USED &&
|
||||
xregs[i].guest_reg == DSP_REG_NONE)
|
||||
{
|
||||
xregs[i].guest_reg = DSP_REG_USED;
|
||||
}
|
||||
if (cache.xregs[i].guest_reg == DSP_REG_NONE &&
|
||||
xregs[i].guest_reg == DSP_REG_USED)
|
||||
{
|
||||
xregs[i].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//consistency checks
|
||||
// consistency checks
|
||||
for(i = 0; i < NUMXREGS; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[i].guest_reg == cache.xregs[i].guest_reg,
|
||||
"cache and current xreg guest_reg mismatch for %d", i);
|
||||
"cache and current xreg guest_reg mismatch for %zi", i);
|
||||
}
|
||||
|
||||
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(),
|
||||
"cache and current reg loc mismatch for %x", i);
|
||||
"cache and current reg loc mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].loc.GetSimpleReg() == cache.regs[i].loc.GetSimpleReg(),
|
||||
"cache and current reg loc mismatch for %x", i);
|
||||
"cache and current reg loc mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].dirty || !cache.regs[i].dirty,
|
||||
"cache and current reg dirty mismatch for %x", i);
|
||||
"cache and current reg dirty mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].used == cache.regs[i].used,
|
||||
"cache and current reg used mismatch for %x", i);
|
||||
"cache and current reg used mismatch for %zi", i);
|
||||
_assert_msg_(DSPLLE,
|
||||
regs[i].shift == cache.regs[i].shift,
|
||||
"cache and current reg shift mismatch for %x", i);
|
||||
"cache and current reg shift mismatch for %zi", i);
|
||||
}
|
||||
|
||||
use_ctr = cache.use_ctr;
|
||||
|
@ -299,9 +315,9 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
|
||||
void DSPJitRegCache::flushMemBackedRegs()
|
||||
{
|
||||
//also needs to undo any dynamic changes to static allocated regs
|
||||
//this should have the same effect as
|
||||
//merge(DSPJitRegCache(emitter));
|
||||
// also needs to undo any dynamic changes to static allocated regs
|
||||
// this should have the same effect as
|
||||
// merge(DSPJitRegCache(emitter));
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
|
@ -309,7 +325,9 @@ void DSPJitRegCache::flushMemBackedRegs()
|
|||
"register %x still in use", i);
|
||||
|
||||
if (regs[i].used)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
|
@ -330,65 +348,67 @@ void DSPJitRegCache::flushRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
!regs[i].loc.IsSimpleReg(),
|
||||
"register %x is still a simple reg", i);
|
||||
!regs[i].loc.IsSimpleReg(),
|
||||
"register %x is still a simple reg", i);
|
||||
}
|
||||
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[RSP].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", RSP);
|
||||
xregs[RSP].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", RSP);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[RBX].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", RBX);
|
||||
xregs[RBX].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", RBX);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[RBP].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", RBP);
|
||||
xregs[RBP].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", RBP);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[RSI].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", RSI);
|
||||
xregs[RSI].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", RSI);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[RDI].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", RDI);
|
||||
xregs[RDI].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", RDI);
|
||||
#ifdef _M_X64
|
||||
#ifdef STATIC_REG_ACCS
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R8].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", R8);
|
||||
xregs[R8].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", R8);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R9].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", R9);
|
||||
xregs[R9].guest_reg == DSP_REG_STATIC,
|
||||
"wrong xreg state for %d", R9);
|
||||
#else
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R8].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R8);
|
||||
xregs[R8].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R8);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R9].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R9);
|
||||
xregs[R9].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R9);
|
||||
#endif
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R10].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R10);
|
||||
xregs[R10].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R10);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R11].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R11);
|
||||
xregs[R11].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R11);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R12].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R12);
|
||||
xregs[R12].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R12);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R13].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R13);
|
||||
xregs[R13].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R13);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R14].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R14);
|
||||
xregs[R14].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R14);
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[R15].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R15);
|
||||
xregs[R15].guest_reg == DSP_REG_NONE,
|
||||
"wrong xreg state for %d", R15);
|
||||
#endif
|
||||
|
||||
use_ctr = 0;
|
||||
|
@ -401,7 +421,9 @@ void DSPJitRegCache::loadRegs(bool emit)
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToHostReg(i,regs[i].host_reg, emit);
|
||||
}
|
||||
}
|
||||
|
||||
if (emit)
|
||||
|
@ -421,14 +443,16 @@ void DSPJitRegCache::saveRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
!regs[i].loc.IsSimpleReg(),
|
||||
"register %x is still a simple reg", i);
|
||||
!regs[i].loc.IsSimpleReg(),
|
||||
"register %x is still a simple reg", i);
|
||||
}
|
||||
|
||||
#ifdef _M_X64
|
||||
|
@ -445,7 +469,9 @@ void DSPJitRegCache::pushRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToMemory(i);
|
||||
}
|
||||
}
|
||||
|
||||
int push_count = 0;
|
||||
|
@ -458,10 +484,14 @@ void DSPJitRegCache::pushRegs()
|
|||
//hardcoding alignment to 16 bytes
|
||||
#ifdef _M_X64
|
||||
if (push_count & 1)
|
||||
{
|
||||
emitter.SUB(64,R(RSP),Imm32(8));
|
||||
}
|
||||
#else
|
||||
if (push_count & 3)
|
||||
{
|
||||
emitter.SUB(32,R(ESP),Imm32(16 - 4 * (push_count & 3)));
|
||||
}
|
||||
#endif
|
||||
|
||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
||||
|
@ -477,16 +507,16 @@ void DSPJitRegCache::pushRegs()
|
|||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
!regs[i].loc.IsSimpleReg(),
|
||||
"register %x is still a simple reg", i);
|
||||
!regs[i].loc.IsSimpleReg(),
|
||||
"register %x is still a simple reg", i);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < NUMXREGS; i++)
|
||||
{
|
||||
_assert_msg_(DSPLLE,
|
||||
xregs[i].guest_reg == DSP_REG_NONE ||
|
||||
xregs[i].guest_reg == DSP_REG_STATIC,
|
||||
"register %x is still used", i);
|
||||
xregs[i].guest_reg == DSP_REG_NONE ||
|
||||
xregs[i].guest_reg == DSP_REG_STATIC,
|
||||
"register %x is still used", i);
|
||||
}
|
||||
|
||||
#ifdef _M_X64
|
||||
|
@ -506,7 +536,9 @@ void DSPJitRegCache::popRegs() {
|
|||
for(auto& xreg : xregs)
|
||||
{
|
||||
if (xreg.pushed)
|
||||
{
|
||||
push_count++;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = NUMXREGS-1; i >= 0; i--)
|
||||
|
@ -522,16 +554,22 @@ void DSPJitRegCache::popRegs() {
|
|||
//hardcoding alignment to 16 bytes
|
||||
#ifdef _M_X64
|
||||
if (push_count & 1)
|
||||
{
|
||||
emitter.ADD(64,R(RSP),Imm32(8));
|
||||
}
|
||||
#else
|
||||
if (push_count & 3)
|
||||
{
|
||||
emitter.ADD(32,R(ESP),Imm32(16 - 4 * (push_count & 3)));
|
||||
}
|
||||
#endif
|
||||
|
||||
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
|
||||
{
|
||||
if (regs[i].host_reg != INVALID_REG)
|
||||
{
|
||||
movToHostReg(i,regs[i].host_reg, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +585,9 @@ X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg)
|
|||
X64Reg safe = findSpillFreeXReg();
|
||||
_assert_msg_(DSPLLE, safe != INVALID_REG, "could not find register");
|
||||
if (safe == INVALID_REG)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
xregs[RBP].guest_reg = rbp_guest;
|
||||
#ifdef _M_X64
|
||||
emitter.MOV(64,R(safe),R(reg));
|
||||
|
@ -560,29 +600,36 @@ X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg)
|
|||
void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
|
||||
{
|
||||
_assert_msg_(DSPLLE, reg >= 0 && reg <= DSP_REG_MAX_MEM_BACKED,
|
||||
"bad register name %x", reg);
|
||||
"bad register name %x", reg);
|
||||
_assert_msg_(DSPLLE, regs[reg].parentReg == DSP_REG_NONE,
|
||||
"register %x is proxy for %x", reg, regs[reg].parentReg);
|
||||
"register %x is proxy for %x", reg, regs[reg].parentReg);
|
||||
_assert_msg_(DSPLLE, !regs[reg].used,
|
||||
"moving to host reg in use guest reg %x!", reg);
|
||||
"moving to host reg in use guest reg %x!", reg);
|
||||
X64Reg old_reg = regs[reg].loc.GetSimpleReg();
|
||||
if (old_reg == host_reg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (xregs[host_reg].guest_reg != DSP_REG_STATIC)
|
||||
{
|
||||
xregs[host_reg].guest_reg = reg;
|
||||
}
|
||||
|
||||
if (load)
|
||||
{
|
||||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.MOV(16, R(host_reg), regs[reg].loc); break;
|
||||
emitter.MOV(16, R(host_reg), regs[reg].loc);
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, R(host_reg), regs[reg].loc); break;
|
||||
emitter.MOV(32, R(host_reg), regs[reg].loc);
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.MOV(64, R(host_reg), regs[reg].loc); break;
|
||||
emitter.MOV(64, R(host_reg), regs[reg].loc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_assert_msg_(DSPLLE, 0, "unsupported memory size");
|
||||
|
@ -592,30 +639,40 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
|
|||
|
||||
regs[reg].loc = R(host_reg);
|
||||
if (old_reg != INVALID_REG &&
|
||||
xregs[old_reg].guest_reg != DSP_REG_STATIC)
|
||||
xregs[old_reg].guest_reg != DSP_REG_STATIC)
|
||||
{
|
||||
xregs[old_reg].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void DSPJitRegCache::movToHostReg(int reg, bool load)
|
||||
{
|
||||
_assert_msg_(DSPLLE, reg >= 0 && reg <= DSP_REG_MAX_MEM_BACKED,
|
||||
"bad register name %x", reg);
|
||||
"bad register name %x", reg);
|
||||
_assert_msg_(DSPLLE, regs[reg].parentReg == DSP_REG_NONE,
|
||||
"register %x is proxy for %x", reg, regs[reg].parentReg);
|
||||
"register %x is proxy for %x", reg, regs[reg].parentReg);
|
||||
_assert_msg_(DSPLLE, !regs[reg].used,
|
||||
"moving to host reg in use guest reg %x!", reg);
|
||||
"moving to host reg in use guest reg %x!", reg);
|
||||
|
||||
if (regs[reg].loc.IsSimpleReg())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
X64Reg tmp;
|
||||
if (regs[reg].host_reg != INVALID_REG)
|
||||
{
|
||||
tmp = regs[reg].host_reg;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = findSpillFreeXReg();
|
||||
}
|
||||
|
||||
if (tmp == INVALID_REG)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
movToHostReg(reg, tmp, load);
|
||||
}
|
||||
|
@ -623,30 +680,27 @@ void DSPJitRegCache::movToHostReg(int reg, bool load)
|
|||
void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
|
||||
{
|
||||
_assert_msg_(DSPLLE, reg >= 0 && reg <= DSP_REG_MAX_MEM_BACKED,
|
||||
"bad register name %x", reg);
|
||||
"bad register name %x", reg);
|
||||
_assert_msg_(DSPLLE, regs[reg].parentReg == DSP_REG_NONE,
|
||||
"register %x is proxy for %x", reg, regs[reg].parentReg);
|
||||
"register %x is proxy for %x", reg, regs[reg].parentReg);
|
||||
_assert_msg_(DSPLLE, regs[reg].loc.IsSimpleReg(),
|
||||
"register %x is not a simple reg", reg);
|
||||
"register %x is not a simple reg", reg);
|
||||
_assert_msg_(DSPLLE, !regs[reg].used,
|
||||
"rotating in use guest reg %x!", reg);
|
||||
"rotating in use guest reg %x!", reg);
|
||||
|
||||
if (shift > regs[reg].shift && emit)
|
||||
{
|
||||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.ROR(16, regs[reg].loc,
|
||||
Imm8(shift - regs[reg].shift));
|
||||
emitter.ROR(16, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||
break;
|
||||
case 4:
|
||||
emitter.ROR(32, regs[reg].loc,
|
||||
Imm8(shift - regs[reg].shift));
|
||||
emitter.ROR(32, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.ROR(64, regs[reg].loc,
|
||||
Imm8(shift - regs[reg].shift));
|
||||
emitter.ROR(64, regs[reg].loc, Imm8(shift - regs[reg].shift));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -656,17 +710,14 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
|
|||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.ROL(16, regs[reg].loc,
|
||||
Imm8(regs[reg].shift - shift));
|
||||
emitter.ROL(16, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||
break;
|
||||
case 4:
|
||||
emitter.ROL(32, regs[reg].loc,
|
||||
Imm8(regs[reg].shift - shift));
|
||||
emitter.ROL(32, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.ROL(64, regs[reg].loc,
|
||||
Imm8(regs[reg].shift - shift));
|
||||
emitter.ROL(64, regs[reg].loc, Imm8(regs[reg].shift - shift));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -684,11 +735,15 @@ void DSPJitRegCache::movToMemory(int reg)
|
|||
"moving to memory in use guest reg %x!", reg);
|
||||
|
||||
if (regs[reg].used)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
|
||||
if (!regs[reg].loc.IsSimpleReg() &&
|
||||
!regs[reg].loc.IsImm())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//but first, check for any needed rotations
|
||||
if (regs[reg].loc.IsSimpleReg())
|
||||
|
@ -710,12 +765,15 @@ void DSPJitRegCache::movToMemory(int reg)
|
|||
switch(regs[reg].size)
|
||||
{
|
||||
case 2:
|
||||
emitter.MOV(16, tmp, regs[reg].loc); break;
|
||||
emitter.MOV(16, tmp, regs[reg].loc);
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, tmp, regs[reg].loc); break;
|
||||
emitter.MOV(32, tmp, regs[reg].loc);
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.MOV(64, tmp, regs[reg].loc); break;
|
||||
emitter.MOV(64, tmp, regs[reg].loc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_assert_msg_(DSPLLE, 0, "unsupported memory size");
|
||||
|
@ -728,7 +786,9 @@ void DSPJitRegCache::movToMemory(int reg)
|
|||
{
|
||||
X64Reg hostreg = regs[reg].loc.GetSimpleReg();
|
||||
if (xregs[hostreg].guest_reg != DSP_REG_STATIC)
|
||||
{
|
||||
xregs[hostreg].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
regs[reg].last_use_ctr = -1;
|
||||
|
@ -756,17 +816,19 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
|
|||
}
|
||||
|
||||
_assert_msg_(DSPLLE, !regs[real_reg].used,
|
||||
"register %x already in use", real_reg);
|
||||
"register %x already in use", real_reg);
|
||||
|
||||
if (regs[real_reg].used)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
// no nead to actually emit code for load or rotate if caller doesn't
|
||||
// use the contents, but see above for a reason to force the load
|
||||
movToHostReg(real_reg, load);
|
||||
|
||||
// TODO: actually handle INVALID_REG
|
||||
_assert_msg_(DSPLLE, regs[real_reg].loc.IsSimpleReg(),
|
||||
"did not get host reg for %x", reg);
|
||||
"did not get host reg for %x", reg);
|
||||
|
||||
rotateHostReg(real_reg, shift, load);
|
||||
oparg = regs[real_reg].loc;
|
||||
|
@ -778,16 +840,14 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
|
|||
#ifdef _M_X64
|
||||
case DSP_REG_ACC0_64:
|
||||
case DSP_REG_ACC1_64:
|
||||
{
|
||||
if (load)
|
||||
{
|
||||
//need to do this because interpreter only does 48 bits
|
||||
//(and putReg does the same)
|
||||
emitter.SHL(64, oparg, Imm8(64-40));//sign extend
|
||||
// need to do this because interpreter only does 48 bits
|
||||
// (and putReg does the same)
|
||||
emitter.SHL(64, oparg, Imm8(64-40)); // sign extend
|
||||
emitter.SAR(64, oparg, Imm8(64-40));
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
@ -806,24 +866,23 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
{
|
||||
case DSP_REG_ACH0:
|
||||
case DSP_REG_ACH1:
|
||||
{
|
||||
if (dirty)
|
||||
{
|
||||
//no need to extend to full 64bit here until interpreter
|
||||
//uses that
|
||||
// no need to extend to full 64bit here until interpreter
|
||||
// uses that
|
||||
if (oparg.IsSimpleReg())
|
||||
{
|
||||
//register is already shifted correctly
|
||||
//(if at all)
|
||||
// register is already shifted correctly
|
||||
// (if at all)
|
||||
|
||||
// sign extend from the bottom 8 bits.
|
||||
#ifndef _M_X64
|
||||
//cannot use movsx with SPL, BPL, SIL or DIL
|
||||
//on 32 bit
|
||||
// cannot use movsx with SPL, BPL, SIL or DIL
|
||||
// on 32 bit
|
||||
if (oparg.GetSimpleReg() == RSP ||
|
||||
oparg.GetSimpleReg() == RBP ||
|
||||
oparg.GetSimpleReg() == RSI ||
|
||||
oparg.GetSimpleReg() == RDI)
|
||||
oparg.GetSimpleReg() == RBP ||
|
||||
oparg.GetSimpleReg() == RSI ||
|
||||
oparg.GetSimpleReg() == RDI)
|
||||
{
|
||||
emitter.SHL(16,oparg,Imm8(8));
|
||||
emitter.SAR(16,oparg,Imm8(8));
|
||||
|
@ -831,9 +890,7 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
emitter.MOVSX(16, 8,
|
||||
oparg.GetSimpleReg(),
|
||||
oparg);
|
||||
emitter.MOVSX(16, 8, oparg.GetSimpleReg(), oparg);
|
||||
}
|
||||
}
|
||||
else if (oparg.IsImm())
|
||||
|
@ -842,8 +899,8 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
}
|
||||
else
|
||||
{
|
||||
//this works on the memory, so use reg instead
|
||||
//of real_reg, since it has the right loc
|
||||
// this works on the memory, so use reg instead
|
||||
// of real_reg, since it has the right loc
|
||||
X64Reg tmp;
|
||||
getFreeXReg(tmp);
|
||||
// sign extend from the bottom 8 bits.
|
||||
|
@ -852,19 +909,16 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
|
|||
putXReg(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case DSP_REG_ACC0_64:
|
||||
case DSP_REG_ACC1_64:
|
||||
{
|
||||
if (dirty)
|
||||
{
|
||||
emitter.SHL(64, oparg, Imm8(64-40));//sign extend
|
||||
emitter.SHL(64, oparg, Imm8(64-40)); // sign extend
|
||||
emitter.SAR(64, oparg, Imm8(64-40));
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
@ -891,30 +945,46 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend
|
|||
switch(extend)
|
||||
{
|
||||
#ifdef _M_X64
|
||||
case SIGN: emitter.MOVSX(64, 16, host_dreg, reg); break;
|
||||
case ZERO: emitter.MOVZX(64, 16, host_dreg, reg); break;
|
||||
case SIGN:
|
||||
emitter.MOVSX(64, 16, host_dreg, reg);
|
||||
break;
|
||||
case ZERO:
|
||||
emitter.MOVZX(64, 16, host_dreg, reg);
|
||||
break;
|
||||
#else
|
||||
case SIGN: emitter.MOVSX(32, 16, host_dreg, reg); break;
|
||||
case ZERO: emitter.MOVZX(32, 16, host_dreg, reg); break;
|
||||
case SIGN:
|
||||
emitter.MOVSX(32, 16, host_dreg, reg);
|
||||
break;
|
||||
case ZERO:
|
||||
emitter.MOVZX(32, 16, host_dreg, reg);
|
||||
break;
|
||||
#endif
|
||||
case NONE: emitter.MOV(16, R(host_dreg), reg); break;
|
||||
case NONE:
|
||||
emitter.MOV(16, R(host_dreg), reg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
#ifdef _M_X64
|
||||
switch(extend)
|
||||
{
|
||||
case SIGN: emitter.MOVSX(64, 32, host_dreg, reg); break;
|
||||
case ZERO: emitter.MOVZX(64, 32, host_dreg, reg); break;
|
||||
case NONE: emitter.MOV(32, R(host_dreg), reg); break;
|
||||
case SIGN:
|
||||
emitter.MOVSX(64, 32, host_dreg, reg);
|
||||
break;
|
||||
case ZERO:
|
||||
emitter.MOVZX(64, 32, host_dreg, reg);
|
||||
break;
|
||||
case NONE:
|
||||
emitter.MOV(32, R(host_dreg), reg);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
emitter.MOV(32, R(host_dreg), reg); break;
|
||||
emitter.MOV(32, R(host_dreg), reg);
|
||||
#endif
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
emitter.MOV(64, R(host_dreg), reg); break;
|
||||
emitter.MOV(64, R(host_dreg), reg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -932,14 +1002,22 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
|
|||
{
|
||||
switch(regs[dreg].size)
|
||||
{
|
||||
case 2: emitter.MOV(16, reg, Imm16((u16) arg.offset)); break;
|
||||
case 4: emitter.MOV(32, reg, Imm32((u32) arg.offset)); break;
|
||||
case 2:
|
||||
emitter.MOV(16, reg, Imm16((u16) arg.offset));
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, reg, Imm32((u32) arg.offset));
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8:
|
||||
if ((u32) arg.offset == arg.offset)
|
||||
{
|
||||
emitter.MOV(64, reg, Imm32((u32) arg.offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
emitter.MOV(64, reg, Imm64(arg.offset));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -951,10 +1029,16 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
|
|||
{
|
||||
switch(regs[dreg].size)
|
||||
{
|
||||
case 2: emitter.MOV(16, reg, arg); break;
|
||||
case 4: emitter.MOV(32, reg, arg); break;
|
||||
case 2:
|
||||
emitter.MOV(16, reg, arg);
|
||||
break;
|
||||
case 4:
|
||||
emitter.MOV(32, reg, arg);
|
||||
break;
|
||||
#ifdef _M_X64
|
||||
case 8: emitter.MOV(64, reg, arg); break;
|
||||
case 8:
|
||||
emitter.MOV(64, reg, arg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_assert_msg_(DSPLLE, 0, "unsupported memory size");
|
||||
|
@ -976,18 +1060,15 @@ static X64Reg alloc_order[] = {
|
|||
|
||||
X64Reg DSPJitRegCache::spillXReg()
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int max_use_ctr_diff = 0;
|
||||
int max_use_ctr_diff = 0;
|
||||
X64Reg least_recent_use_reg = INVALID_REG;
|
||||
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for(size_t i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
{
|
||||
X64Reg reg = alloc_order[i];
|
||||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
{
|
||||
unsigned int use_ctr_diff = use_ctr -
|
||||
regs[xregs[reg].guest_reg].last_use_ctr;
|
||||
|
||||
int use_ctr_diff = use_ctr - regs[xregs[reg].guest_reg].last_use_ctr;
|
||||
if (use_ctr_diff >= max_use_ctr_diff)
|
||||
{
|
||||
max_use_ctr_diff = use_ctr_diff;
|
||||
|
@ -1003,11 +1084,11 @@ X64Reg DSPJitRegCache::spillXReg()
|
|||
}
|
||||
|
||||
//just choose one.
|
||||
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
for(size_t i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
|
||||
{
|
||||
X64Reg reg = alloc_order[i];
|
||||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
!regs[xregs[reg].guest_reg].used)
|
||||
{
|
||||
movToMemory(xregs[reg].guest_reg);
|
||||
return reg;
|
||||
|
@ -1022,16 +1103,16 @@ void DSPJitRegCache::spillXReg(X64Reg reg)
|
|||
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED)
|
||||
{
|
||||
_assert_msg_(DSPLLE, !regs[xregs[reg].guest_reg].used,
|
||||
"to be spilled host reg %x(guest reg %x) still in use!",
|
||||
reg, xregs[reg].guest_reg);
|
||||
"to be spilled host reg %x(guest reg %x) still in use!",
|
||||
reg, xregs[reg].guest_reg);
|
||||
|
||||
movToMemory(xregs[reg].guest_reg);
|
||||
}
|
||||
else
|
||||
{
|
||||
_assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_NONE,
|
||||
"to be spilled host reg %x still in use!",
|
||||
reg);
|
||||
"to be spilled host reg %x still in use!",
|
||||
reg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1132,9 @@ X64Reg DSPJitRegCache::findSpillFreeXReg()
|
|||
{
|
||||
X64Reg reg = findFreeXReg();
|
||||
if (reg == INVALID_REG)
|
||||
{
|
||||
reg = spillXReg();
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
|
||||
|
@ -1061,7 +1144,9 @@ void DSPJitRegCache::getFreeXReg(X64Reg ®)
|
|||
|
||||
_assert_msg_(DSPLLE, reg != INVALID_REG, "could not find register");
|
||||
if (reg == INVALID_REG)
|
||||
{
|
||||
emitter.INT3();
|
||||
}
|
||||
xregs[reg].guest_reg = DSP_REG_USED;
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1159,9 @@ void DSPJitRegCache::getXReg(X64Reg reg)
|
|||
}
|
||||
|
||||
if (xregs[reg].guest_reg != DSP_REG_NONE)
|
||||
{
|
||||
spillXReg(reg);
|
||||
}
|
||||
_assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_NONE, "register already in use");
|
||||
xregs[reg].guest_reg = DSP_REG_USED;
|
||||
}
|
||||
|
@ -1088,7 +1175,7 @@ void DSPJitRegCache::putXReg(X64Reg reg)
|
|||
}
|
||||
|
||||
_assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_USED,
|
||||
"putXReg without get(Free)XReg");
|
||||
"putXReg without get(Free)XReg");
|
||||
|
||||
xregs[reg].guest_reg = DSP_REG_NONE;
|
||||
}
|
||||
|
|
|
@ -59,8 +59,10 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
|
|||
u32 cmdStart = 0;
|
||||
u32 nextMemUpdate = 0;
|
||||
|
||||
#if LOG_FIFO_CMDS
|
||||
// Debugging
|
||||
vector<CmdData> prevCmds;
|
||||
#endif
|
||||
|
||||
while (cmdStart < frame.fifoDataSize)
|
||||
{
|
||||
|
@ -75,7 +77,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
|
|||
|
||||
u32 cmdSize = DecodeCommand(&frame.fifoData[cmdStart]);
|
||||
|
||||
#if (LOG_FIFO_CMDS)
|
||||
#if LOG_FIFO_CMDS
|
||||
CmdData cmdData;
|
||||
cmdData.offset = cmdStart;
|
||||
cmdData.ptr = &frame.fifoData[cmdStart];
|
||||
|
@ -118,7 +120,7 @@ void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrame
|
|||
for (const auto& range : m_WrittenMemory)
|
||||
{
|
||||
if (range.begin < end &&
|
||||
range.end > begin)
|
||||
range.end > begin)
|
||||
{
|
||||
s32 preSize = range.begin - begin;
|
||||
s32 postSize = end - range.end;
|
||||
|
@ -210,7 +212,9 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
|
|||
FifoAnalyzer::LoadBPReg(bp, m_BpMem);
|
||||
|
||||
if (bp.address == BPMEM_TRIGGER_EFB_COPY)
|
||||
{
|
||||
StoreEfbCopyRegion();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -256,9 +260,13 @@ void FifoPlaybackAnalyzer::StoreEfbCopyRegion()
|
|||
{
|
||||
format |= _GX_TF_ZTF;
|
||||
if (copyfmt == 11)
|
||||
{
|
||||
format = GX_TF_Z16;
|
||||
}
|
||||
else if (format < GX_TF_Z8 || format > GX_TF_Z24X8)
|
||||
{
|
||||
format |= _GX_TF_CTF;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -280,8 +280,10 @@ void Init(bool hle)
|
|||
void Shutdown()
|
||||
{
|
||||
if (!g_ARAM.wii_mode)
|
||||
{
|
||||
FreeMemoryPages(g_ARAM.ptr, g_ARAM.size);
|
||||
g_ARAM.ptr = NULL;
|
||||
g_ARAM.ptr = NULL;
|
||||
}
|
||||
|
||||
dsp_emulator->Shutdown();
|
||||
delete dsp_emulator;
|
||||
|
@ -563,7 +565,7 @@ void Do_ARAM_DMA()
|
|||
{
|
||||
while (g_arDMA.Cnt.count)
|
||||
{
|
||||
// These are logically seperated in code to show that a memory map has been set up
|
||||
// These are logically separated in code to show that a memory map has been set up
|
||||
// See below in the write section for more information
|
||||
if ((g_ARAM_Info.Hex & 0xf) == 3)
|
||||
{
|
||||
|
|
|
@ -296,7 +296,7 @@ restart:
|
|||
{
|
||||
PB.ReachedEnd = 0;
|
||||
|
||||
if ((PB.RepeatMode == 0) || (!PB.StopOnSilence == 0))
|
||||
if ((PB.RepeatMode == 0) || (PB.StopOnSilence != 0))
|
||||
{
|
||||
PB.KeyOff = 1;
|
||||
PB.RemLength = 0;
|
||||
|
@ -657,7 +657,6 @@ ContinueWithBlock:
|
|||
switch (count) {
|
||||
case 0: _LeftBuffer[i] += (u64)unmixed_audio * ramp >> 29; break;
|
||||
case 1: _RightBuffer[i] += (u64)unmixed_audio * ramp >> 29; break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,11 +129,8 @@ CEXIIPL::~CEXIIPL()
|
|||
m_szBuffer[m_count] = 0x00;
|
||||
}
|
||||
|
||||
if (m_pIPL != NULL)
|
||||
{
|
||||
FreeMemoryPages(m_pIPL, ROM_SIZE);
|
||||
m_pIPL = NULL;
|
||||
}
|
||||
FreeMemoryPages(m_pIPL, ROM_SIZE);
|
||||
m_pIPL = NULL;
|
||||
|
||||
// SRAM
|
||||
File::IOFile file(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM, "wb");
|
||||
|
|
|
@ -813,7 +813,6 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
|
|||
{
|
||||
File::IOFile gci(gcih);
|
||||
unsigned int offset;
|
||||
char tmp[0xD];
|
||||
std::string fileType;
|
||||
SplitPath(inputFile, NULL, NULL, &fileType);
|
||||
|
||||
|
@ -821,7 +820,8 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
|
|||
offset = GCI;
|
||||
else
|
||||
{
|
||||
gci.ReadBytes(tmp, 0xD);
|
||||
char tmp[0xD];
|
||||
gci.ReadBytes(tmp, sizeof(tmp));
|
||||
if (!strcasecmp(fileType.c_str(), ".gcs"))
|
||||
{
|
||||
if (!memcmp(tmp, "GCSAVE", 6)) // Header must be uppercase
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
|
@ -10,17 +11,17 @@ namespace WiimoteEmu
|
|||
// Extension device IDs to be written to the last bytes of the extension reg
|
||||
// The id for nothing inserted
|
||||
static const u8 nothing_id[] = { 0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e };
|
||||
// The id for a partially inserted extension
|
||||
static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
|
||||
// The id for a partially inserted extension (currently unused)
|
||||
UNUSED static const u8 partially_id[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
|
||||
|
||||
Attachment::Attachment( const char* const _name, WiimoteEmu::ExtensionReg& _reg )
|
||||
: name( _name ), reg( _reg )
|
||||
Attachment::Attachment(const char* const _name, WiimoteEmu::ExtensionReg& _reg)
|
||||
: name(_name), reg(_reg)
|
||||
{
|
||||
memset(id, 0, sizeof(id));
|
||||
memset(calibration, 0, sizeof(calibration));
|
||||
}
|
||||
|
||||
None::None( WiimoteEmu::ExtensionReg& _reg ) : Attachment( "None", _reg )
|
||||
None::None(WiimoteEmu::ExtensionReg& _reg) : Attachment("None", _reg)
|
||||
{
|
||||
// set up register
|
||||
memcpy(&id, nothing_id, sizeof(nothing_id));
|
||||
|
@ -34,14 +35,14 @@ std::string Attachment::GetName() const
|
|||
void Attachment::Reset()
|
||||
{
|
||||
// set up register
|
||||
memset( ®, 0, WIIMOTE_REG_EXT_SIZE );
|
||||
memcpy( ®.constant_id, id, sizeof(id) );
|
||||
memcpy( ®.calibration, calibration, sizeof(calibration) );
|
||||
memset(®, 0, WIIMOTE_REG_EXT_SIZE);
|
||||
memcpy(®.constant_id, id, sizeof(id));
|
||||
memcpy(®.calibration, calibration, sizeof(calibration));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ControllerEmu::Extension::GetState( u8* const data, const bool focus )
|
||||
void ControllerEmu::Extension::GetState(u8* const data, const bool focus)
|
||||
{
|
||||
((WiimoteEmu::Attachment*)attachments[active_extension].get())->GetState( data, focus );
|
||||
((WiimoteEmu::Attachment*)attachments[active_extension].get())->GetState(data, focus);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,6 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
}
|
||||
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
std::stringstream name;
|
||||
static int num = 0;
|
||||
|
||||
if (num == 0)
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
#include "Core/HW/WiimoteEmu/Attachment/Turntable.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
|
||||
|
||||
inline double round(double x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); } //because damn MSVSC doesen't comply to C99
|
||||
|
||||
namespace
|
||||
{
|
||||
// :)
|
||||
|
@ -523,8 +520,8 @@ void Wiimote::GetIRData(u8* const data, bool use_accel)
|
|||
MatrixTransformVertex(tot,v[i]);
|
||||
if ((v[i].x<-1)||(v[i].x>1)||(v[i].y<-1)||(v[i].y>1))
|
||||
continue;
|
||||
x[i]=(u16)round((v[i].x+1)/2*(camWidth-1));
|
||||
y[i]=(u16)round((v[i].y+1)/2*(camHeight-1));
|
||||
x[i] = (u16)lround((v[i].x+1)/2*(camWidth-1));
|
||||
y[i] = (u16)lround((v[i].y+1)/2*(camHeight-1));
|
||||
}
|
||||
// PanicAlert("%f %f\n%f %f\n%f %f\n%f %f\n%d %d\n%d %d\n%d %d\n%d %d",
|
||||
// v[0].x,v[0].y,v[1].x,v[1].y,v[2].x,v[2].y,v[3].x,v[3].y,
|
||||
|
@ -649,13 +646,10 @@ void Wiimote::Update()
|
|||
u8 data[MAX_PAYLOAD];
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
// figure out what data we need
|
||||
s8 rptf_size = MAX_PAYLOAD;
|
||||
|
||||
Movie::SetPolledDevice();
|
||||
|
||||
const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE];
|
||||
rptf_size = rptf.size;
|
||||
s8 rptf_size = rptf.size;
|
||||
if (Movie::IsPlayingInput() && Movie::PlayWiimote(m_index, data, rptf, m_reg_ir.mode))
|
||||
{
|
||||
if (rptf.core)
|
||||
|
|
|
@ -96,7 +96,7 @@ inline void init_lib()
|
|||
HidD_SetOutputReport = (PHidD_SetOutputReport)GetProcAddress(hid_lib, "HidD_SetOutputReport");
|
||||
HidD_GetProductString = (PHidD_GetProductString)GetProcAddress(hid_lib, "HidD_GetProductString");
|
||||
if (!HidD_GetHidGuid || !HidD_GetAttributes ||
|
||||
!HidD_SetOutputReport || !HidD_GetProductString)
|
||||
!HidD_SetOutputReport || !HidD_GetProductString)
|
||||
{
|
||||
PanicAlertT("Failed to load hid.dll! Connecting real Wiimotes won't work and Dolphin might crash unexpectedly!");
|
||||
return;
|
||||
|
@ -122,11 +122,11 @@ inline void init_lib()
|
|||
Bth_BluetoothEnumerateInstalledServices = (PBth_BluetoothEnumerateInstalledServices)GetProcAddress(bthprops_lib, "BluetoothEnumerateInstalledServices");
|
||||
|
||||
if (!Bth_BluetoothFindDeviceClose || !Bth_BluetoothFindFirstDevice ||
|
||||
!Bth_BluetoothFindFirstRadio || !Bth_BluetoothFindNextDevice ||
|
||||
!Bth_BluetoothFindNextRadio || !Bth_BluetoothFindRadioClose ||
|
||||
!Bth_BluetoothGetRadioInfo || !Bth_BluetoothRemoveDevice ||
|
||||
!Bth_BluetoothSetServiceState || !Bth_BluetoothAuthenticateDevice ||
|
||||
!Bth_BluetoothEnumerateInstalledServices)
|
||||
!Bth_BluetoothFindFirstRadio || !Bth_BluetoothFindNextDevice ||
|
||||
!Bth_BluetoothFindNextRadio || !Bth_BluetoothFindRadioClose ||
|
||||
!Bth_BluetoothGetRadioInfo || !Bth_BluetoothRemoveDevice ||
|
||||
!Bth_BluetoothSetServiceState || !Bth_BluetoothAuthenticateDevice ||
|
||||
!Bth_BluetoothEnumerateInstalledServices)
|
||||
{
|
||||
PanicAlertT("Failed to load bthprops.cpl! Connecting real Wiimotes won't work and Dolphin might crash unexpectedly!");
|
||||
return;
|
||||
|
@ -316,10 +316,10 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
|
|||
#endif
|
||||
|
||||
HANDLE dev_handle = CreateFile(devicepath.c_str(),
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
|
||||
NULL);
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,
|
||||
NULL);
|
||||
if (dev_handle == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
// enable to only check for official nintendo wiimotes/bb's
|
||||
|
@ -331,7 +331,6 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
|
|||
(attrib.VendorID == 0x057e) &&
|
||||
(attrib.ProductID == 0x0306)))
|
||||
{
|
||||
int rc = 0;
|
||||
// max_cycles insures we are never stuck here due to bad coding...
|
||||
int max_cycles = 20;
|
||||
u8 buf[MAX_PAYLOAD] = {0};
|
||||
|
@ -343,19 +342,19 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
|
|||
u8 const disable_enc_pt1_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xf0, 0x01, 0x55};
|
||||
u8 const disable_enc_pt2_report[MAX_PAYLOAD] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xfb, 0x01, 0x00};
|
||||
|
||||
rc = CheckDeviceType_Write(dev_handle,
|
||||
disable_enc_pt1_report,
|
||||
sizeof(disable_enc_pt1_report),
|
||||
1);
|
||||
rc = CheckDeviceType_Write(dev_handle,
|
||||
disable_enc_pt2_report,
|
||||
sizeof(disable_enc_pt2_report),
|
||||
1);
|
||||
CheckDeviceType_Write(dev_handle,
|
||||
disable_enc_pt1_report,
|
||||
sizeof(disable_enc_pt1_report),
|
||||
1);
|
||||
CheckDeviceType_Write(dev_handle,
|
||||
disable_enc_pt2_report,
|
||||
sizeof(disable_enc_pt2_report),
|
||||
1);
|
||||
|
||||
rc = CheckDeviceType_Write(dev_handle,
|
||||
req_status_report,
|
||||
sizeof(req_status_report),
|
||||
1);
|
||||
int rc = CheckDeviceType_Write(dev_handle,
|
||||
req_status_report,
|
||||
sizeof(req_status_report),
|
||||
1);
|
||||
|
||||
while (rc > 0 && --max_cycles > 0)
|
||||
{
|
||||
|
@ -411,15 +410,15 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
|
|||
// 0x020420A40000ULL means balance board.
|
||||
u64 ext_type = (*(u64*)&wrdr->data[0]);
|
||||
// DEBUG_LOG(WIIMOTE,
|
||||
// "CheckDeviceType: GOT EXT TYPE %llX",
|
||||
// ext_type);
|
||||
// "CheckDeviceType: GOT EXT TYPE %llX",
|
||||
// ext_type);
|
||||
is_bb = (ext_type == 0x020420A40000ULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(WIIMOTE,
|
||||
"CheckDeviceType: GOT UNREQUESTED ADDRESS %X",
|
||||
Common::swap16(wrdr->address));
|
||||
"CheckDeviceType: GOT UNREQUESTED ADDRESS %X",
|
||||
Common::swap16(wrdr->address));
|
||||
}
|
||||
// force end
|
||||
rc = -1;
|
||||
|
@ -681,7 +680,6 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
|
|||
}
|
||||
|
||||
return result;
|
||||
break;
|
||||
}
|
||||
case MSBT_STACK_BLUESOLEIL:
|
||||
{
|
||||
|
@ -764,7 +762,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
|
|||
{
|
||||
// btdi.szName is sometimes missing it's content - it's a bt feature..
|
||||
DEBUG_LOG(WIIMOTE, "Authenticated %i connected %i remembered %i ",
|
||||
btdi.fAuthenticated, btdi.fConnected, btdi.fRemembered);
|
||||
btdi.fAuthenticated, btdi.fConnected, btdi.fRemembered);
|
||||
|
||||
if (IsValidBluetoothName(UTF16ToUTF8(btdi.szName)))
|
||||
{
|
||||
|
@ -807,16 +805,18 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
|
|||
auto const& wm_addr = btdi.Address.rgBytes;
|
||||
|
||||
NOTICE_LOG(WIIMOTE, "Found Wiimote (%02x:%02x:%02x:%02x:%02x:%02x). Enabling HID service.",
|
||||
wm_addr[0], wm_addr[1], wm_addr[2], wm_addr[3], wm_addr[4], wm_addr[5]);
|
||||
wm_addr[0], wm_addr[1], wm_addr[2], wm_addr[3], wm_addr[4], wm_addr[5]);
|
||||
|
||||
#if defined(AUTHENTICATE_WIIMOTES)
|
||||
// Authenticate
|
||||
auto const& radio_addr = radio_info.address.rgBytes;
|
||||
const DWORD auth_result = Bth_BluetoothAuthenticateDevice(NULL, hRadio, &btdi,
|
||||
std::vector<WCHAR>(radio_addr, radio_addr + 6).data(), 6);
|
||||
std::vector<WCHAR>(radio_addr, radio_addr + 6).data(), 6);
|
||||
|
||||
if (ERROR_SUCCESS != auth_result)
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothAuthenticateDevice returned %08x", auth_result);
|
||||
}
|
||||
|
||||
DWORD pcServices = 16;
|
||||
GUID guids[16];
|
||||
|
@ -824,18 +824,24 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
|
|||
const DWORD srv_result = Bth_BluetoothEnumerateInstalledServices(hRadio, &btdi, &pcServices, guids);
|
||||
|
||||
if (ERROR_SUCCESS != srv_result)
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothEnumerateInstalledServices returned %08x", srv_result);
|
||||
}
|
||||
#endif
|
||||
// Activate service
|
||||
const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi,
|
||||
&HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE);
|
||||
&HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE);
|
||||
|
||||
g_connect_times[btdi.Address.ullLong] = std::time(nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothSetServiceState returned %08x", hr);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -851,8 +857,8 @@ bool ForgetWiimote(BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
|
|||
auto const avoid_forget_seconds = 5.0;
|
||||
|
||||
auto pair_time = g_connect_times.find(btdi.Address.ullLong);
|
||||
if (pair_time == g_connect_times.end()
|
||||
|| std::difftime(time(nullptr), pair_time->second) >= avoid_forget_seconds)
|
||||
if (pair_time == g_connect_times.end() ||
|
||||
std::difftime(time(nullptr), pair_time->second) >= avoid_forget_seconds)
|
||||
{
|
||||
// Make Windows forget about device so it will re-find it if visible.
|
||||
// This is also required to detect a disconnect for some reason..
|
||||
|
|
|
@ -468,14 +468,12 @@ int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress)
|
|||
// More than ~1150K "bytes / sec" hangs NSMBWii on boot.
|
||||
// Less than ~800K "bytes / sec" hangs DKCR randomly (ok, probably not true)
|
||||
return SystemTimers::GetTicksPerSecond() / 975000 * Size;
|
||||
break;
|
||||
}
|
||||
|
||||
case DVDLowClearCoverInterrupt:
|
||||
// Less than ~1/155th of a second hangs Oregon Trail at "loading wheel".
|
||||
// More than ~1/140th of a second hangs Resident Evil Archives: Resident Evil Zero.
|
||||
return SystemTimers::GetTicksPerSecond() / 146;
|
||||
break;
|
||||
|
||||
// case DVDLowAudioBufferConfig:
|
||||
// case DVDLowInquiry:
|
||||
|
@ -489,6 +487,5 @@ int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress)
|
|||
// random numbers here!
|
||||
// More than ~1/2000th of a second hangs DKCR with DSP HLE, maybe.
|
||||
return SystemTimers::GetTicksPerSecond() / 15000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,6 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||
deviceCommandAddress = _CommandAddress;
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case IOCTL_HID_OPEN:
|
||||
{
|
||||
|
@ -210,7 +209,6 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
|
||||
// It's the async way!
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case IOCTL_HID_INTERRUPT_OUT:
|
||||
case IOCTL_HID_INTERRUPT_IN:
|
||||
|
@ -242,7 +240,6 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
|
||||
// It's the async way!
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case IOCTL_HID_SHUTDOWN:
|
||||
{
|
||||
|
|
|
@ -722,7 +722,6 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
|
|||
WiiSockMan &sm = WiiSockMan::getInstance();
|
||||
sm.doSock(fd, _CommandAddress, (NET_IOCTL)Command);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////
|
||||
// TODO: Tidy all below //
|
||||
|
|
|
@ -610,10 +610,8 @@ void NetPlayServer::unmapPortThread()
|
|||
// discovers the IGD
|
||||
bool NetPlayServer::initUPnP()
|
||||
{
|
||||
UPNPDev *devlist;
|
||||
std::vector<UPNPDev *> igds;
|
||||
int descXMLsize = 0, upnperror = 0;
|
||||
char *descXML;
|
||||
|
||||
// Don't init if already inited
|
||||
if (m_upnp_inited)
|
||||
|
@ -627,7 +625,7 @@ bool NetPlayServer::initUPnP()
|
|||
memset(&m_upnp_data, 0, sizeof(IGDdatas));
|
||||
|
||||
// Find all UPnP devices
|
||||
devlist = upnpDiscover(2000, NULL, NULL, 0, 0, &upnperror);
|
||||
UPNPDev *devlist = upnpDiscover(2000, NULL, NULL, 0, 0, &upnperror);
|
||||
if (!devlist)
|
||||
{
|
||||
WARN_LOG(NETPLAY, "An error occured trying to discover UPnP devices.");
|
||||
|
@ -647,7 +645,7 @@ bool NetPlayServer::initUPnP()
|
|||
|
||||
for (const UPNPDev* dev : igds)
|
||||
{
|
||||
descXML = (char *) miniwget(dev->descURL, &descXMLsize, 0);
|
||||
char* descXML = (char*) miniwget(dev->descURL, &descXMLsize, 0);
|
||||
if (descXML)
|
||||
{
|
||||
parserootdesc(descXML, descXMLsize, &m_upnp_data);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common/Common.h"
|
||||
|
||||
#include "Common/FPURoundMode.h"
|
||||
|
||||
// --- Gekko Instruction ---
|
||||
|
||||
|
@ -390,7 +390,7 @@ union UReg_FPSCR
|
|||
struct
|
||||
{
|
||||
// Rounding mode (towards: nearest, zero, +inf, -inf)
|
||||
u32 RN : 2;
|
||||
enum FPURoundMode::RoundModes RN : 2;
|
||||
// Non-IEEE mode enable (aka flush-to-zero)
|
||||
u32 NI : 1;
|
||||
// Inexact exception enable
|
||||
|
|
|
@ -366,7 +366,7 @@ void Jit64::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
|
||||
strncat(regs, reg, 500);
|
||||
strncat(regs, reg, sizeof(regs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -375,7 +375,7 @@ void Jit64::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "f%02d: %016x ", i, riPS0(i));
|
||||
strncat(fregs, reg, 750);
|
||||
strncat(fregs, reg, sizeof(fregs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
static const u64 GC_ALIGNED16(psSignBits2[2]) = {0x8000000000000000ULL, 0x8000000000000000ULL};
|
||||
static const u64 GC_ALIGNED16(psAbsMask2[2]) = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL};
|
||||
static const double GC_ALIGNED16(psOneOne2[2]) = {1.0, 1.0};
|
||||
static const double one_const = 1.0f;
|
||||
|
||||
void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (XEmitter::*op)(Gen::X64Reg, Gen::OpArg))
|
||||
|
|
|
@ -2111,7 +2111,7 @@ void Jit64::srawix(UGeckoInstruction inst)
|
|||
}
|
||||
else
|
||||
{
|
||||
Default(inst); return;
|
||||
Default(inst); return; // FIXME
|
||||
gpr.Lock(a, s);
|
||||
JitClearCA();
|
||||
gpr.BindToRegister(a, a == s, true);
|
||||
|
|
|
@ -16,10 +16,8 @@ namespace {
|
|||
|
||||
// pshufb todo: MOVQ
|
||||
const u8 GC_ALIGNED16(bswapShuffle1x4[16]) = {3, 2, 1, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
const u8 GC_ALIGNED16(bswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
const u8 GC_ALIGNED16(bswapShuffle1x8[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
const u8 GC_ALIGNED16(bswapShuffle1x8Dupe[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0};
|
||||
const u8 GC_ALIGNED16(bswapShuffle2x8[16]) = {7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8};
|
||||
|
||||
u64 GC_ALIGNED16(temp64);
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#include "Core/PowerPC/Jit64/JitAsm.h"
|
||||
#include "Core/PowerPC/Jit64/JitRegCache.h"
|
||||
|
||||
const u8 GC_ALIGNED16(pbswapShuffle2x4[16]) = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
|
||||
// The big problem is likely instructions that set the quantizers in the same block.
|
||||
// We will have to break block after quantizers are written to.
|
||||
void Jit64::psq_st(UGeckoInstruction inst)
|
||||
|
|
|
@ -463,7 +463,7 @@ void JitIL::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
|
||||
strncat(regs, reg, 500);
|
||||
strncat(regs, reg, sizeof(regs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -472,7 +472,7 @@ void JitIL::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "f%02d: %016x ", i, riPS0(i));
|
||||
strncat(fregs, reg, 750);
|
||||
strncat(fregs, reg, sizeof(fregs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ void JitArm::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]);
|
||||
strncat(regs, reg, 500);
|
||||
strncat(regs, reg, sizeof(regs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -237,7 +237,7 @@ void JitArm::Trace()
|
|||
{
|
||||
char reg[50];
|
||||
sprintf(reg, "f%02d: %016x ", i, riPS0(i));
|
||||
strncat(fregs, reg, 750);
|
||||
strncat(fregs, reg, sizeof(fregs) - 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void JitArm::subfic(UGeckoInstruction inst)
|
|||
{
|
||||
INSTRUCTION_START
|
||||
JITDISABLE(bJITIntegerOff)
|
||||
Default(inst); return;
|
||||
Default(inst); return; // FIXME
|
||||
int a = inst.RA, d = inst.RD;
|
||||
|
||||
int imm = inst.SIMM_16;
|
||||
|
@ -615,7 +615,7 @@ void JitArm::addex(UGeckoInstruction inst)
|
|||
INSTRUCTION_START
|
||||
JITDISABLE(bJITIntegerOff)
|
||||
u32 a = inst.RA, b = inst.RB, d = inst.RD;
|
||||
Default(inst); return;
|
||||
Default(inst); return; // FIXME
|
||||
ARMReg RA = gpr.R(a);
|
||||
ARMReg RB = gpr.R(b);
|
||||
ARMReg RD = gpr.R(d);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "Core/PowerPC/PPCTables.h"
|
||||
#include "Core/PowerPC/JitArmIL/JitIL.h"
|
||||
|
||||
|
||||
// FIXME
|
||||
#define NORMALBRANCH_START Default(inst); ibuild.EmitInterpreterBranch(); return;
|
||||
//#define NORMALBRANCH_START
|
||||
|
||||
|
|
|
@ -1296,7 +1296,7 @@ void IRBuilder::WriteToFile(u64 codeHash) {
|
|||
alwaysUseds.find(opcode) != alwaysUseds.end();
|
||||
|
||||
// Line number
|
||||
fprintf(file, "%4d", i);
|
||||
fprintf(file, "%4u", i);
|
||||
|
||||
if (!thisUsed) {
|
||||
fprintf(file, "%*c", 32, ' ');
|
||||
|
|
|
@ -77,7 +77,6 @@ namespace JitInterface
|
|||
PanicAlert("Unrecognizable cpu_core: %d", core);
|
||||
jit = NULL;
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
jit = static_cast<JitBase*>(ptr);
|
||||
|
|
|
@ -211,7 +211,7 @@ bool PPCSymbolDB::LoadMap(const char *filename)
|
|||
continue;
|
||||
|
||||
char temp[256];
|
||||
sscanf(line, "%s", temp);
|
||||
sscanf(line, "%255s", temp);
|
||||
|
||||
if (strcmp(temp, "UNUSED")==0) continue;
|
||||
if (strcmp(temp, ".text")==0) {started = true; continue;};
|
||||
|
@ -234,7 +234,7 @@ bool PPCSymbolDB::LoadMap(const char *filename)
|
|||
|
||||
u32 address, vaddress, size, unknown;
|
||||
char name[512];
|
||||
sscanf(line, "%08x %08x %08x %i %s", &address, &size, &vaddress, &unknown, name);
|
||||
sscanf(line, "%08x %08x %08x %i %511s", &address, &size, &vaddress, &unknown, name);
|
||||
|
||||
const char *namepos = strstr(line, name);
|
||||
if (namepos != 0) //would be odd if not :P
|
||||
|
|
|
@ -184,9 +184,10 @@ std::map<double, int> GetSavedStates()
|
|||
std::map<double, int> m;
|
||||
for (int i = 1; i <= (int)NUM_STATES; i++)
|
||||
{
|
||||
if (File::Exists(MakeStateFilename(i)))
|
||||
std::string filename = MakeStateFilename(i);
|
||||
if (File::Exists(filename))
|
||||
{
|
||||
if (ReadHeader(MakeStateFilename(i), header))
|
||||
if (ReadHeader(filename, header))
|
||||
{
|
||||
double d = Common::Timer::GetDoubleTime() - header.time;
|
||||
// increase time until unique value is obtained
|
||||
|
@ -340,7 +341,7 @@ void SaveAs(const std::string& filename, bool wait)
|
|||
Core::PauseAndLock(false, wasUnpaused);
|
||||
}
|
||||
|
||||
bool ReadHeader(const std::string filename, StateHeader& header)
|
||||
bool ReadHeader(const std::string& filename, StateHeader& header)
|
||||
{
|
||||
Flush();
|
||||
File::IOFile f(filename, "rb");
|
||||
|
|
|
@ -29,7 +29,7 @@ void Shutdown();
|
|||
|
||||
void EnableCompression(bool compression);
|
||||
|
||||
bool ReadHeader(const std::string filename, StateHeader& header);
|
||||
bool ReadHeader(const std::string& filename, StateHeader& header);
|
||||
|
||||
// These don't happen instantly - they get scheduled as events.
|
||||
// ...But only if we're not in the main cpu thread.
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <polarssl/sha1.h>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Crypto/tools.h"
|
||||
#include "Common/Crypto/ec.h"
|
||||
|
||||
#include "Core/ec_wii.h"
|
||||
|
||||
|
|
|
@ -89,9 +89,7 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
|
|||
return (DWORD)EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
//Where in the x86 code are we?
|
||||
PVOID codeAddr = pPtrs->ExceptionRecord->ExceptionAddress;
|
||||
unsigned char *codePtr = (unsigned char*)codeAddr;
|
||||
// virtual address of the inaccessible data
|
||||
u64 badAddress = (u64)pPtrs->ExceptionRecord->ExceptionInformation[1];
|
||||
CONTEXT *ctx = pPtrs->ContextRecord;
|
||||
|
||||
|
@ -104,7 +102,6 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
|
|||
// Let's not prevent debugging.
|
||||
return (DWORD)EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
|
|
|
@ -374,9 +374,9 @@ void CNANDContentLoader::RemoveTitle() const
|
|||
// remove tmd?
|
||||
for (u32 i = 0; i < m_numEntries; i++)
|
||||
{
|
||||
char szFilename[1024];
|
||||
if (!(m_Content[i].m_Type & 0x8000)) // skip shared apps
|
||||
{
|
||||
char szFilename[1024];
|
||||
sprintf(szFilename, "%s%08x.app", Common::GetTitleContentPath(m_TitleID).c_str(), m_Content[i].m_ContentID);
|
||||
INFO_LOG(DISCIO, "Delete %s", szFilename);
|
||||
File::Delete(szFilename);
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
|
||||
namespace DiscIO
|
||||
{
|
||||
const u64 wii_sector_size = 0x8000;
|
||||
const u64 wii_sector_count = 143432 * 2;
|
||||
const u64 wii_sector_log2 = 15;
|
||||
const u64 wii_disc_header_size = 256;
|
||||
static const u64 wii_sector_size = 0x8000;
|
||||
static const u64 wii_sector_count = 143432 * 2;
|
||||
static const u64 wii_disc_header_size = 256;
|
||||
|
||||
static inline u64 align(u64 value, u64 bounds)
|
||||
{
|
||||
|
|
|
@ -114,8 +114,7 @@ namespace ButtonManager
|
|||
}
|
||||
bool GetButtonPressed(int padID, ButtonType button)
|
||||
{
|
||||
bool pressed = false;
|
||||
pressed = m_buttons[std::make_pair(padID, button)]->Pressed();
|
||||
bool pressed = m_buttons[std::make_pair(padID, button)]->Pressed();
|
||||
|
||||
for (const auto& ctrl : m_controllers)
|
||||
pressed |= ctrl.second->ButtonValue(padID, button);
|
||||
|
|
|
@ -368,7 +368,7 @@ void CConfigMain::InitializeGUIValues()
|
|||
if (startup_params.bDSPHLE)
|
||||
DSPEngine->SetSelection(0);
|
||||
else
|
||||
DSPEngine->SetSelection(SConfig::GetInstance().m_EnableJIT ? 1 : 2);
|
||||
DSPEngine->SetSelection(SConfig::GetInstance().m_DSPEnableJIT ? 1 : 2);
|
||||
|
||||
// Audio
|
||||
VolumeSlider->Enable(SupportsVolumeChanges(SConfig::GetInstance().sBackend));
|
||||
|
@ -957,8 +957,7 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
|
|||
{
|
||||
case ID_DSPENGINE:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = DSPEngine->GetSelection() == 0;
|
||||
if (!DSPEngine->GetSelection() == 0)
|
||||
SConfig::GetInstance().m_EnableJIT = DSPEngine->GetSelection() == 1;
|
||||
SConfig::GetInstance().m_DSPEnableJIT = DSPEngine->GetSelection() == 1;
|
||||
AudioCommon::UpdateSoundStream();
|
||||
break;
|
||||
|
||||
|
|
|
@ -228,10 +228,6 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
|||
dc.GetTextExtent(_T("W"),&w,&h);
|
||||
int fontSize = w;
|
||||
int textPlacement = 17 + 9 * fontSize;
|
||||
struct branch
|
||||
{
|
||||
int src, dst, srcAddr;
|
||||
};
|
||||
|
||||
// TODO: Add any drawing code here...
|
||||
int width = rc.width;
|
||||
|
|
|
@ -916,7 +916,6 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
|
|||
|
||||
void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
|
||||
{
|
||||
std::vector<const DiscIO::SFileInfo *> fst;
|
||||
DiscIO::IFileSystem *FS = NULL;
|
||||
wxString Path = wxDirSelector(_("Choose the folder to extract to"));
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, u32 width, u32 height
|
|||
|
||||
u8 *pdata = new u8[bytes];
|
||||
|
||||
memset(pdata,0,bytes);
|
||||
memcpy(pdata,hdr,sizeof(hdr));
|
||||
memset(pdata+sizeof(hdr),0,bytes-sizeof(hdr));
|
||||
|
||||
u8 *pixelData = pdata + sizeof(hdr);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "Common/MathUtil.h"
|
||||
#include "Common/NandPaths.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Crypto/tools.h"
|
||||
#include "Common/Crypto/ec.h"
|
||||
#include "DolphinWX/MemoryCards/WiiSaveCrypted.h"
|
||||
|
||||
static Common::replace_v replacements;
|
||||
|
@ -368,7 +368,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
|
|||
for(u32 i = 0; i < _numberOfFiles; i++)
|
||||
{
|
||||
FileHDR tmpFileHDR;
|
||||
std::string __name, __ext;
|
||||
std::string __name;
|
||||
memset(&tmpFileHDR, 0, FILE_HDR_SZ);
|
||||
|
||||
u32 _fileSize = 0;
|
||||
|
|
|
@ -442,7 +442,7 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings)
|
|||
settings.m_CPUthread = instance.m_LocalCoreStartupParameter.bCPUThread;
|
||||
settings.m_CPUcore = instance.m_LocalCoreStartupParameter.iCPUCore;
|
||||
settings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE;
|
||||
settings.m_DSPEnableJIT = instance.m_EnableJIT;
|
||||
settings.m_DSPEnableJIT = instance.m_DSPEnableJIT;
|
||||
settings.m_WriteToMemcard = m_memcard_write->GetValue();
|
||||
settings.m_EXIDevice[0] = instance.m_EXIDevice[0];
|
||||
settings.m_EXIDevice[1] = instance.m_EXIDevice[1];
|
||||
|
@ -657,11 +657,6 @@ PadMapDiag::PadMapDiag(wxWindow* const parent, PadMapping map[], PadMapping wiim
|
|||
for (auto& player : m_player_list)
|
||||
player_names.Add(player->name);
|
||||
|
||||
wxString wiimote_names[5];
|
||||
wiimote_names[0] = _("None");
|
||||
for (unsigned int i=1; i < 5; ++i)
|
||||
wiimote_names[i] = wxString(_("Wiimote ")) + (wxChar)(wxT('0')+i);
|
||||
|
||||
for (unsigned int i=0; i<4; ++i)
|
||||
{
|
||||
wxBoxSizer* const v_szr = new wxBoxSizer(wxVERTICAL);
|
||||
|
|
|
@ -54,9 +54,9 @@ double GetCurrentBitmapLogicalScale()
|
|||
{
|
||||
#ifdef __APPLE__
|
||||
// wx doesn't expose this itself, unfortunately.
|
||||
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
|
||||
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
|
||||
{
|
||||
return [[NSScreen mainScreen] backingScaleFactor];
|
||||
return [[NSScreen mainScreen] backingScaleFactor];
|
||||
}
|
||||
#endif
|
||||
return 1.0;
|
||||
|
|
|
@ -138,7 +138,6 @@ KeyboardMouse::KeyboardMouse(const LPDIRECTINPUTDEVICE8 kb_device, const LPDIREC
|
|||
|
||||
void GetMousePos(float* const x, float* const y)
|
||||
{
|
||||
unsigned int win_width = 2, win_height = 2;
|
||||
POINT point = { 1, 1 };
|
||||
GetCursorPos(&point);
|
||||
// Get the cursor position relative to the upper left corner of the rendering window
|
||||
|
@ -148,8 +147,8 @@ void GetMousePos(float* const x, float* const y)
|
|||
RECT rect;
|
||||
GetClientRect(hwnd, &rect);
|
||||
// Width and height is the size of the rendering window
|
||||
win_width = rect.right - rect.left;
|
||||
win_height = rect.bottom - rect.top;
|
||||
unsigned int win_width = rect.right - rect.left;
|
||||
unsigned int win_height = rect.bottom - rect.top;
|
||||
|
||||
// Return the mouse position as a range from -1 to 1
|
||||
*x = (float)point.x / (float)win_width * 2 - 1;
|
||||
|
|
|
@ -154,8 +154,6 @@ bool VideoBackend::Initialize(void *&window_handle)
|
|||
|
||||
frameCount = 0;
|
||||
|
||||
const SCoreStartupParameter& core_params = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str());
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
|
|
|
@ -272,6 +272,7 @@ public:
|
|||
glBindBuffer(m_buffertype, 0);
|
||||
glFinish(); // ogl pipeline must be flushed, else this buffer can be in use
|
||||
FreeAlignedMemory(m_pointer);
|
||||
m_pointer = NULL;
|
||||
}
|
||||
|
||||
std::pair<u8*, size_t> Map(size_t size, u32 stride) {
|
||||
|
|
|
@ -55,7 +55,7 @@ static u32 s_DepthCbufid;
|
|||
static u32 s_Textures[8];
|
||||
static u32 s_ActiveTexture;
|
||||
|
||||
bool SaveTexture(const std::string filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
|
||||
bool SaveTexture(const std::string& filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
|
||||
{
|
||||
if (GLInterface->GetMode() != GLInterfaceMode::MODE_OPENGL)
|
||||
return false;
|
||||
|
@ -121,7 +121,7 @@ void TextureCache::TCacheEntry::Bind(unsigned int stage)
|
|||
}
|
||||
}
|
||||
|
||||
bool TextureCache::TCacheEntry::Save(const std::string filename, unsigned int level)
|
||||
bool TextureCache::TCacheEntry::Save(const std::string& filename, unsigned int level)
|
||||
{
|
||||
return SaveTexture(filename, GL_TEXTURE_2D, texture, virtual_width, virtual_height, level);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
const float *colmat) override;
|
||||
|
||||
void Bind(unsigned int stage) override;
|
||||
bool Save(const std::string filename, unsigned int level);
|
||||
bool Save(const std::string& filename, unsigned int level);
|
||||
};
|
||||
|
||||
~TextureCache();
|
||||
|
@ -59,6 +59,6 @@ private:
|
|||
TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h) override;
|
||||
};
|
||||
|
||||
bool SaveTexture(const std::string filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level);
|
||||
bool SaveTexture(const std::string& filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level);
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void Init()
|
|||
}
|
||||
}
|
||||
|
||||
void SaveTexture(const std::string filename, u32 texmap, s32 mip)
|
||||
void SaveTexture(const std::string& filename, u32 texmap, s32 mip)
|
||||
{
|
||||
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
|
||||
u8 subTexmap = texmap & 3;
|
||||
|
@ -123,7 +123,7 @@ void DumpActiveTextures()
|
|||
}
|
||||
}
|
||||
|
||||
void DumpEfb(const std::string filename)
|
||||
void DumpEfb(const std::string& filename)
|
||||
{
|
||||
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
|
||||
u8 *writePtr = data;
|
||||
|
@ -146,7 +146,7 @@ void DumpEfb(const std::string filename)
|
|||
delete[] data;
|
||||
}
|
||||
|
||||
void DumpDepth(const std::string filename)
|
||||
void DumpDepth(const std::string& filename)
|
||||
{
|
||||
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
|
||||
u8 *writePtr = data;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "VideoCommon/VertexShaderManager.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
const bool renderFog = false;
|
||||
namespace BPFunctions
|
||||
{
|
||||
// ----------------------------------------------
|
||||
|
|
|
@ -32,7 +32,7 @@ static void LogFPSToFile(unsigned long val)
|
|||
s_bench_file.Open(File::GetUserPath(D_LOGS_IDX) + "fps.txt", "w");
|
||||
|
||||
char buffer[256];
|
||||
snprintf(buffer, 256, "%ld\n", val);
|
||||
snprintf(buffer, 256, "%lu\n", val);
|
||||
s_bench_file.WriteArray(buffer, strlen(buffer));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ void Fifo_Shutdown()
|
|||
{
|
||||
if (GpuRunningState) PanicAlert("Fifo shutting down while active");
|
||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
||||
videoBuffer = NULL;
|
||||
}
|
||||
|
||||
u8* GetVideoBufferStartPtr()
|
||||
|
|
|
@ -26,7 +26,7 @@ Inputs:
|
|||
data : This is an array of RGBA with 8 bits per channel. 4 bytes for each pixel.
|
||||
row_stride: Determines the amount of bytes per row of pixels.
|
||||
*/
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string filename, int width, int height, bool saveAlpha)
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string& filename, int width, int height, bool saveAlpha)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
#include "Common/Common.h"
|
||||
|
||||
bool SaveData(const char* filename, const char* pdata);
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string filename, int width, int height, bool saveAlpha = true);
|
||||
bool TextureToPng(u8* data, int row_stride, const std::string& filename, int width, int height, bool saveAlpha = true);
|
||||
|
|
|
@ -73,11 +73,8 @@ void TextureCache::Invalidate()
|
|||
TextureCache::~TextureCache()
|
||||
{
|
||||
Invalidate();
|
||||
if (temp)
|
||||
{
|
||||
FreeAlignedMemory(temp);
|
||||
temp = NULL;
|
||||
}
|
||||
FreeAlignedMemory(temp);
|
||||
temp = NULL;
|
||||
}
|
||||
|
||||
void TextureCache::OnConfigChanged(VideoConfig& config)
|
||||
|
@ -238,11 +235,11 @@ bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsign
|
|||
|
||||
for (unsigned int level = 1; level < levels; ++level)
|
||||
{
|
||||
sprintf(texPathTemp, "%s_mip%i", texBasePathTemp, level);
|
||||
sprintf(texPathTemp, "%s_mip%u", texBasePathTemp, level);
|
||||
if (!HiresTextures::HiresTexExists(texPathTemp))
|
||||
{
|
||||
if (level > 1)
|
||||
WARN_LOG(VIDEO, "Couldn't find custom texture LOD with index %i (filename: %s), disabling custom LODs for this texture", level, texPathTemp);
|
||||
WARN_LOG(VIDEO, "Couldn't find custom texture LOD with index %u (filename: %s), disabling custom LODs for this texture", level, texPathTemp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -260,7 +257,7 @@ PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsign
|
|||
if (level == 0)
|
||||
sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat);
|
||||
else
|
||||
sprintf(texPathTemp, "%s_%08x_%i_mip%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level);
|
||||
sprintf(texPathTemp, "%s_%08x_%i_mip%u", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level);
|
||||
|
||||
unsigned int required_size = 0;
|
||||
PC_TexFormat ret = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, &required_size, texformat, temp_size, temp);
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
virtual ~TCacheEntryBase();
|
||||
|
||||
virtual void Bind(unsigned int stage) = 0;
|
||||
virtual bool Save(const std::string filename, unsigned int level) = 0;
|
||||
virtual bool Save(const std::string& filename, unsigned int level) = 0;
|
||||
|
||||
virtual void Load(unsigned int width, unsigned int height,
|
||||
unsigned int expanded_width, unsigned int level) = 0;
|
||||
|
|
|
@ -141,13 +141,13 @@ void WriteToBitDepth(char*& p, u8 depth, const char* src, const char* dest)
|
|||
WRITE(p, " %s = floor(%s * 255.0 / exp2(8.0 - %d.0));\n", dest, src, depth);
|
||||
}
|
||||
|
||||
void WriteEncoderEnd(char* p, API_TYPE ApiType)
|
||||
void WriteEncoderEnd(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WRITE(p, "}\n");
|
||||
IntensityConstantAdded = false;
|
||||
}
|
||||
|
||||
void WriteI8Encoder(char* p, API_TYPE ApiType)
|
||||
void WriteI8Encoder(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_I8, ApiType);
|
||||
WRITE(p, " float3 texSample;\n");
|
||||
|
@ -169,7 +169,7 @@ void WriteI8Encoder(char* p, API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteI4Encoder(char* p, API_TYPE ApiType)
|
||||
void WriteI4Encoder(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_I4, ApiType);
|
||||
WRITE(p, " float3 texSample;\n");
|
||||
|
@ -210,7 +210,7 @@ void WriteI4Encoder(char* p, API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteIA8Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteIA8Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_IA8, ApiType);
|
||||
WRITE(p, " float4 texSample;\n");
|
||||
|
@ -228,7 +228,7 @@ void WriteIA8Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteIA4Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteIA4Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_IA4, ApiType);
|
||||
WRITE(p, " float4 texSample;\n");
|
||||
|
@ -260,7 +260,7 @@ void WriteIA4Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGB565Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGB565Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGB565, ApiType);
|
||||
|
||||
|
@ -283,7 +283,7 @@ void WriteRGB565Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGB5A3Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGB5A3, ApiType);
|
||||
|
||||
|
@ -349,7 +349,7 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGBA4443Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGBA4443Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGB5A3, ApiType);
|
||||
|
||||
|
@ -373,7 +373,7 @@ void WriteRGBA4443Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteRGBA8Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteRGBA8Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_RGBA8, ApiType);
|
||||
|
||||
|
@ -398,7 +398,7 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
||||
void WriteC4Encoder(char*& p, const char* comp,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_R4, ApiType);
|
||||
WRITE(p, " float4 color0;\n");
|
||||
|
@ -420,7 +420,7 @@ void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteC8Encoder(char* p, const char* comp,API_TYPE ApiType)
|
||||
void WriteC8Encoder(char*& p, const char* comp,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_R8, ApiType);
|
||||
|
||||
|
@ -432,7 +432,7 @@ void WriteC8Encoder(char* p, const char* comp,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
||||
void WriteCC4Encoder(char*& p, const char* comp,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_RA4, ApiType);
|
||||
WRITE(p, " float2 texSample;\n");
|
||||
|
@ -462,7 +462,7 @@ void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteCC8Encoder(char* p, const char* comp, API_TYPE ApiType)
|
||||
void WriteCC8Encoder(char*& p, const char* comp, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_RA8, ApiType);
|
||||
|
||||
|
@ -472,7 +472,7 @@ void WriteCC8Encoder(char* p, const char* comp, API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType)
|
||||
void WriteZ8Encoder(char*& p, const char* multiplier,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_Z8M, ApiType);
|
||||
|
||||
|
@ -493,7 +493,7 @@ void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ16Encoder(char* p,API_TYPE ApiType)
|
||||
void WriteZ16Encoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_Z16, ApiType);
|
||||
|
||||
|
@ -525,7 +525,7 @@ void WriteZ16Encoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ16LEncoder(char* p,API_TYPE ApiType)
|
||||
void WriteZ16LEncoder(char*& p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_Z16L, ApiType);
|
||||
|
||||
|
@ -561,7 +561,7 @@ void WriteZ16LEncoder(char* p,API_TYPE ApiType)
|
|||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ24Encoder(char* p, API_TYPE ApiType)
|
||||
void WriteZ24Encoder(char*& p, API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_Z24X8, ApiType);
|
||||
|
||||
|
|
|
@ -177,13 +177,6 @@ int TexDecoder_GetPaletteSize(int format)
|
|||
}
|
||||
}
|
||||
|
||||
static inline u32 decodeIA8(u16 val)
|
||||
{
|
||||
int a = val >> 8;
|
||||
int i = val & 0xFF;
|
||||
return (a << 24) | (i << 16) | (i << 8) | i;
|
||||
}
|
||||
|
||||
static inline u32 decode5A3(u16 val)
|
||||
{
|
||||
int r,g,b,a;
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
|
||||
//BBox
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
#ifndef _M_GENERIC
|
||||
#ifndef __APPLE__
|
||||
#define USE_JIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define COMPILED_CODE_SIZE 4096
|
||||
|
||||
|
@ -472,7 +467,6 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
|
|||
m_compiledCode = NULL;
|
||||
m_numLoadedVertices = 0;
|
||||
m_VertexSize = 0;
|
||||
m_numPipelineStages = 0;
|
||||
m_NativeFmt = 0;
|
||||
loop_counter = 0;
|
||||
VertexLoader_Normal::Init();
|
||||
|
@ -482,11 +476,12 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
|
|||
m_VtxDesc = vtx_desc;
|
||||
SetVAT(vtx_attr.g0.Hex, vtx_attr.g1.Hex, vtx_attr.g2.Hex);
|
||||
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
AllocCodeSpace(COMPILED_CODE_SIZE);
|
||||
CompileVertexTranslator();
|
||||
WriteProtect();
|
||||
#else
|
||||
m_numPipelineStages = 0;
|
||||
CompileVertexTranslator();
|
||||
#endif
|
||||
|
||||
|
@ -494,7 +489,7 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
|
|||
|
||||
VertexLoader::~VertexLoader()
|
||||
{
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
FreeCodeSpace();
|
||||
#endif
|
||||
delete m_NativeFmt;
|
||||
|
@ -505,7 +500,7 @@ void VertexLoader::CompileVertexTranslator()
|
|||
m_VertexSize = 0;
|
||||
const TVtxAttr &vtx_attr = m_VtxAttr;
|
||||
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
if (m_compiledCode)
|
||||
PanicAlert("Trying to recompile a vertex translator");
|
||||
|
||||
|
@ -531,6 +526,9 @@ void VertexLoader::CompileVertexTranslator()
|
|||
WriteSetVariable(32, &s_texmtxwrite, Imm32(0));
|
||||
WriteSetVariable(32, &s_texmtxread, Imm32(0));
|
||||
}
|
||||
#else
|
||||
// Reset pipeline
|
||||
m_numPipelineStages = 0;
|
||||
#endif
|
||||
|
||||
// Colors
|
||||
|
@ -544,8 +542,6 @@ void VertexLoader::CompileVertexTranslator()
|
|||
m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (const u32)((m_VtxDesc.Hex >> 31) & 3)
|
||||
};
|
||||
|
||||
// Reset pipeline
|
||||
m_numPipelineStages = 0;
|
||||
u32 components = 0;
|
||||
|
||||
// Position in pc vertex format.
|
||||
|
@ -770,7 +766,7 @@ void VertexLoader::CompileVertexTranslator()
|
|||
native_stride = nat_offset;
|
||||
vtx_decl.stride = native_stride;
|
||||
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
// End loop here
|
||||
#ifdef _M_X64
|
||||
MOV(64, R(RAX), Imm64((u64)&loop_counter));
|
||||
|
@ -790,7 +786,7 @@ void VertexLoader::CompileVertexTranslator()
|
|||
|
||||
void VertexLoader::WriteCall(TPipelineFunction func)
|
||||
{
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
#ifdef _M_X64
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
|
@ -805,7 +801,7 @@ void VertexLoader::WriteCall(TPipelineFunction func)
|
|||
#ifndef _M_GENERIC
|
||||
void VertexLoader::WriteGetVariable(int bits, OpArg dest, void *address)
|
||||
{
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
#ifdef _M_X64
|
||||
MOV(64, R(RAX), Imm64((u64)address));
|
||||
MOV(bits, dest, MatR(RAX));
|
||||
|
@ -817,7 +813,7 @@ void VertexLoader::WriteGetVariable(int bits, OpArg dest, void *address)
|
|||
|
||||
void VertexLoader::WriteSetVariable(int bits, void *address, OpArg value)
|
||||
{
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
#ifdef _M_X64
|
||||
MOV(64, R(RAX), Imm64((u64)address));
|
||||
MOV(bits, MatR(RAX), value);
|
||||
|
@ -870,7 +866,7 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const
|
|||
|
||||
void VertexLoader::ConvertVertices ( int count )
|
||||
{
|
||||
#ifdef USE_JIT
|
||||
#ifdef USE_VERTEX_LOADER_JIT
|
||||
if (count > 0)
|
||||
{
|
||||
loop_counter = count;
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
#include "VideoCommon/DataReader.h"
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
|
||||
#ifndef _M_GENERIC
|
||||
#ifndef __APPLE__
|
||||
#define USE_VERTEX_LOADER_JIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class VertexLoaderUID
|
||||
{
|
||||
|
@ -119,9 +124,11 @@ private:
|
|||
NativeVertexFormat *m_NativeFmt;
|
||||
int native_stride;
|
||||
|
||||
// Pipeline. To be JIT compiled in the future.
|
||||
#ifndef USE_VERTEX_LOADER_JIT
|
||||
// Pipeline.
|
||||
TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower.
|
||||
int m_numPipelineStages;
|
||||
#endif
|
||||
|
||||
const u8 *m_compiledCode;
|
||||
|
||||
|
|
Loading…
Reference in New Issue