Core: Clean up brace placements
This commit is contained in:
parent
8553b0f27b
commit
eb535be874
|
@ -69,7 +69,8 @@ public:
|
|||
int GetSectionSize(SectionID section) const { return sections[section].sh_size; }
|
||||
SectionID GetSectionByName(const char *name, int firstSection = 0) const; //-1 for not found
|
||||
|
||||
bool DidRelocate() {
|
||||
bool DidRelocate()
|
||||
{
|
||||
return bRelocate;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -275,7 +275,8 @@ bool IsScheduled(int event_type)
|
|||
if (!first)
|
||||
return false;
|
||||
Event *e = first;
|
||||
while (e) {
|
||||
while (e)
|
||||
{
|
||||
if (e->type == event_type)
|
||||
return true;
|
||||
e = e->next;
|
||||
|
|
|
@ -539,7 +539,9 @@ bool DSPAssembler::VerifyParams(const opc_t *opc, param_t *par, int count, bool
|
|||
if ((int)par[i].val < value ||
|
||||
(int)par[i].val > value + get_mask_shifted_down(opc->params[i].mask))
|
||||
{
|
||||
if (ext) fprintf(stderr, "(ext) ");
|
||||
if (ext)
|
||||
fprintf(stderr, "(ext) ");
|
||||
|
||||
fprintf(stderr, "%s (param %i)", cur_line.c_str(), current_param);
|
||||
ShowError(ERR_INVALID_REGISTER);
|
||||
}
|
||||
|
@ -547,7 +549,9 @@ bool DSPAssembler::VerifyParams(const opc_t *opc, param_t *par, int count, bool
|
|||
case P_PRG:
|
||||
if ((int)par[i].val < 0 || (int)par[i].val > 0x3)
|
||||
{
|
||||
if (ext) fprintf(stderr, "(ext) ");
|
||||
if (ext)
|
||||
fprintf(stderr, "(ext) ");
|
||||
|
||||
fprintf(stderr, "%s (param %i)", cur_line.c_str(), current_param);
|
||||
ShowError(ERR_INVALID_REGISTER);
|
||||
}
|
||||
|
@ -555,52 +559,71 @@ bool DSPAssembler::VerifyParams(const opc_t *opc, param_t *par, int count, bool
|
|||
case P_ACC:
|
||||
if ((int)par[i].val < 0x20 || (int)par[i].val > 0x21)
|
||||
{
|
||||
if (ext) fprintf(stderr, "(ext) ");
|
||||
if (par[i].val >= 0x1e && par[i].val <= 0x1f) {
|
||||
if (ext)
|
||||
fprintf(stderr, "(ext) ");
|
||||
|
||||
if (par[i].val >= 0x1e && par[i].val <= 0x1f)
|
||||
{
|
||||
fprintf(stderr, "%i : %s ", code_line, cur_line.c_str());
|
||||
fprintf(stderr, "WARNING: $ACM%d register used instead of $ACC%d register Line: %d Param: %d Ext: %d\n",
|
||||
(par[i].val & 1), (par[i].val & 1), code_line, current_param, ext);
|
||||
}
|
||||
else if (par[i].val >= 0x1c && par[i].val <= 0x1d) {
|
||||
else if (par[i].val >= 0x1c && par[i].val <= 0x1d)
|
||||
{
|
||||
fprintf(stderr, "WARNING: $ACL%d register used instead of $ACC%d register Line: %d Param: %d\n",
|
||||
(par[i].val & 1), (par[i].val & 1), code_line, current_param);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowError(ERR_WRONG_PARAMETER_ACC);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case P_ACCM:
|
||||
if ((int)par[i].val < 0x1e || (int)par[i].val > 0x1f)
|
||||
{
|
||||
if (ext) fprintf(stderr, "(ext) ");
|
||||
if (ext)
|
||||
fprintf(stderr, "(ext) ");
|
||||
|
||||
if (par[i].val >= 0x1c && par[i].val <= 0x1d)
|
||||
{
|
||||
fprintf(stderr, "WARNING: $ACL%d register used instead of $ACM%d register Line: %d Param: %d\n",
|
||||
(par[i].val & 1), (par[i].val & 1), code_line, current_param);
|
||||
}
|
||||
else if (par[i].val >= 0x20 && par[i].val <= 0x21)
|
||||
{
|
||||
fprintf(stderr, "WARNING: $ACC%d register used instead of $ACM%d register Line: %d Param: %d\n",
|
||||
(par[i].val & 1), (par[i].val & 1), code_line, current_param);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowError(ERR_WRONG_PARAMETER_ACC);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case P_ACCL:
|
||||
if ((int)par[i].val < 0x1c || (int)par[i].val > 0x1d)
|
||||
{
|
||||
if (ext) fprintf(stderr, "(ext) ");
|
||||
if (ext)
|
||||
fprintf(stderr, "(ext) ");
|
||||
|
||||
if (par[i].val >= 0x1e && par[i].val <= 0x1f)
|
||||
{
|
||||
fprintf(stderr, "%s ", cur_line.c_str());
|
||||
fprintf(stderr, "WARNING: $ACM%d register used instead of $ACL%d register Line: %d Param: %d\n",
|
||||
(par[i].val & 1), (par[i].val & 1), code_line, current_param);
|
||||
}
|
||||
else if (par[i].val >= 0x20 && par[i].val <= 0x21) {
|
||||
else if (par[i].val >= 0x20 && par[i].val <= 0x21)
|
||||
{
|
||||
fprintf(stderr, "%s ", cur_line.c_str());
|
||||
fprintf(stderr, "WARNING: $ACC%d register used instead of $ACL%d register Line: %d Param: %d\n",
|
||||
(par[i].val & 1), (par[i].val & 1), code_line, current_param);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowError(ERR_WRONG_PARAMETER_ACC);
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* case P_ACCM_D: //P_ACC_MID:
|
||||
|
|
|
@ -185,10 +185,12 @@ void DSPCore_Shutdown()
|
|||
|
||||
core_state = DSPCORE_STOP;
|
||||
|
||||
if (dspjit) {
|
||||
if (dspjit)
|
||||
{
|
||||
delete dspjit;
|
||||
dspjit = nullptr;
|
||||
}
|
||||
|
||||
DSPCore_FreeMemoryPages();
|
||||
|
||||
g_dsp_cap.reset();
|
||||
|
|
|
@ -192,25 +192,33 @@ struct DSP_Regs
|
|||
u16 st[4];
|
||||
u16 cr;
|
||||
u16 sr;
|
||||
union {
|
||||
|
||||
union
|
||||
{
|
||||
u64 val;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
u16 l;
|
||||
u16 m;
|
||||
u16 h;
|
||||
u16 m2;//if this gets in the way, drop it.
|
||||
};
|
||||
} prod;
|
||||
union {
|
||||
|
||||
union
|
||||
{
|
||||
u32 val;
|
||||
struct {
|
||||
u16 l;
|
||||
u16 h;
|
||||
};
|
||||
} ax[2];
|
||||
union {
|
||||
|
||||
union
|
||||
{
|
||||
u64 val;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
u16 l;
|
||||
u16 m;
|
||||
u16 h;
|
||||
|
|
|
@ -370,7 +370,9 @@ void addr(const UDSPInstruction opc)
|
|||
|
||||
s64 acc = dsp_get_long_acc(dreg);
|
||||
s64 ax = 0;
|
||||
switch (sreg) {
|
||||
|
||||
switch (sreg)
|
||||
{
|
||||
case DSP_REG_AXL0:
|
||||
case DSP_REG_AXL1:
|
||||
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
|
||||
|
@ -383,6 +385,7 @@ void addr(const UDSPInstruction opc)
|
|||
ax = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
ax <<= 16;
|
||||
s64 res = acc + ax;
|
||||
|
||||
|
@ -569,7 +572,9 @@ void subr(const UDSPInstruction opc)
|
|||
|
||||
s64 acc = dsp_get_long_acc(dreg);
|
||||
s64 ax = 0;
|
||||
switch (sreg) {
|
||||
|
||||
switch (sreg)
|
||||
{
|
||||
case DSP_REG_AXL0:
|
||||
case DSP_REG_AXL1:
|
||||
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
|
||||
|
@ -582,6 +587,7 @@ void subr(const UDSPInstruction opc)
|
|||
ax = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
ax <<= 16;
|
||||
s64 res = acc - ax;
|
||||
|
||||
|
|
|
@ -111,31 +111,38 @@ inline int GetMultiplyModifier()
|
|||
return (g_dsp.r.sr & SR_MUL_MODIFY)?1:2;
|
||||
}
|
||||
|
||||
inline bool isCarry() {
|
||||
inline bool isCarry()
|
||||
{
|
||||
return (g_dsp.r.sr & SR_CARRY) ? true : false;
|
||||
}
|
||||
|
||||
inline bool isOverflow() {
|
||||
inline bool isOverflow()
|
||||
{
|
||||
return (g_dsp.r.sr & SR_OVERFLOW) ? true : false;
|
||||
}
|
||||
|
||||
inline bool isOverS32() {
|
||||
inline bool isOverS32()
|
||||
{
|
||||
return (g_dsp.r.sr & SR_OVER_S32) ? true : false;
|
||||
}
|
||||
|
||||
inline bool isLess() {
|
||||
inline bool isLess()
|
||||
{
|
||||
return (!(g_dsp.r.sr & SR_OVERFLOW) != !(g_dsp.r.sr & SR_SIGN));
|
||||
}
|
||||
|
||||
inline bool isZero() {
|
||||
inline bool isZero()
|
||||
{
|
||||
return (g_dsp.r.sr & SR_ARITH_ZERO) ? true : false;
|
||||
}
|
||||
|
||||
inline bool isLogicZero() {
|
||||
inline bool isLogicZero()
|
||||
{
|
||||
return (g_dsp.r.sr & SR_LOGIC_ZERO) ? true : false;
|
||||
}
|
||||
|
||||
inline bool isConditionA() {
|
||||
inline bool isConditionA()
|
||||
{
|
||||
return (((g_dsp.r.sr & SR_OVER_S32) || (g_dsp.r.sr & SR_TOP2BITS)) && !(g_dsp.r.sr & SR_ARITH_ZERO)) ? true : false;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
#include "Common/Common.h"
|
||||
|
||||
namespace DSPInterpreter {
|
||||
namespace DSPInterpreter
|
||||
{
|
||||
|
||||
bool CheckCondition(u8 _Condition);
|
||||
|
||||
|
@ -20,19 +21,23 @@ void Update_SR_Register16(s16 _Value, bool carry = false, bool overflow = false,
|
|||
void Update_SR_Register64(s64 _Value, bool carry = false, bool overflow = false);
|
||||
void Update_SR_LZ(bool value);
|
||||
|
||||
inline bool isCarry(u64 val, u64 result) {
|
||||
return (val>result);
|
||||
inline bool isCarry(u64 val, u64 result)
|
||||
{
|
||||
return (val > result);
|
||||
}
|
||||
|
||||
inline bool isCarry2(u64 val, u64 result) {
|
||||
return (val>=result);
|
||||
inline bool isCarry2(u64 val, u64 result)
|
||||
{
|
||||
return (val >= result);
|
||||
}
|
||||
|
||||
inline bool isOverflow(s64 val1, s64 val2, s64 res) {
|
||||
inline bool isOverflow(s64 val1, s64 val2, s64 res)
|
||||
{
|
||||
return ((val1 ^ res) & (val2 ^ res)) < 0;
|
||||
}
|
||||
|
||||
inline bool isOverS32(s64 acc) {
|
||||
inline bool isOverS32(s64 acc)
|
||||
{
|
||||
return (acc != (s32)acc) ? true : false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1358,9 +1358,12 @@ void DSPEmitter::lsrn(const UDSPInstruction opc)
|
|||
// else
|
||||
// shift = accm & 0x3f;
|
||||
|
||||
// if (shift > 0) {
|
||||
// if (shift > 0)
|
||||
// {
|
||||
// acc >>= shift;
|
||||
// } else if (shift < 0) {
|
||||
// }
|
||||
// else if (shift < 0)
|
||||
// {
|
||||
// acc <<= -shift;
|
||||
// }
|
||||
|
||||
|
@ -1414,9 +1417,12 @@ void DSPEmitter::asrn(const UDSPInstruction opc)
|
|||
// else
|
||||
// shift = accm & 0x3f;
|
||||
|
||||
// if (shift > 0) {
|
||||
// if (shift > 0)
|
||||
// {
|
||||
// acc >>= shift;
|
||||
// } else if (shift < 0) {
|
||||
// }
|
||||
// else if (shift < 0)
|
||||
// {
|
||||
// acc <<= -shift;
|
||||
// }
|
||||
|
||||
|
@ -1474,9 +1480,12 @@ void DSPEmitter::lsrnrx(const UDSPInstruction opc)
|
|||
// else
|
||||
// shift = axh & 0x3f;
|
||||
|
||||
// if (shift > 0) {
|
||||
// if (shift > 0)
|
||||
// {
|
||||
// acc <<= shift;
|
||||
// } else if (shift < 0) {
|
||||
// }
|
||||
// else if (shift < 0)
|
||||
// {
|
||||
// acc >>= -shift;
|
||||
// }
|
||||
|
||||
|
|
|
@ -133,16 +133,6 @@ void DSPEmitter::Update_SR_Register64_Carry2(X64Reg val, X64Reg carry_ovfl)
|
|||
Update_SR_Register();
|
||||
}
|
||||
|
||||
//void DSPEmitter::Update_SR_Register16(s16 _Value, bool carry, bool overflow, bool overS32)
|
||||
//{
|
||||
|
||||
// // 0x20 - Checks if top bits of m are equal
|
||||
// if ((((u16)_Value >> 14) == 0) || (((u16)_Value >> 14) == 3))
|
||||
// {
|
||||
// g_dsp.r[DSP_REG_SR] |= SR_TOP2BITS;
|
||||
// }
|
||||
//}
|
||||
|
||||
// In: RAX: s64 _Value
|
||||
// Clobbers RDX
|
||||
void DSPEmitter::Update_SR_Register16(X64Reg val)
|
||||
|
@ -205,86 +195,3 @@ void DSPEmitter::Update_SR_Register16_OverS32(Gen::X64Reg val)
|
|||
//AND(32, R(val), Imm32(0xc0000000));
|
||||
Update_SR_Register16(val);
|
||||
}
|
||||
|
||||
//void DSPEmitter::Update_SR_LZ(bool value) {
|
||||
|
||||
// if (value == true)
|
||||
// g_dsp.r[DSP_REG_SR] |= SR_LOGIC_ZERO;
|
||||
// else
|
||||
// g_dsp.r[DSP_REG_SR] &= ~SR_LOGIC_ZERO;
|
||||
//}
|
||||
|
||||
//inline int GetMultiplyModifier()
|
||||
//{
|
||||
// return (g_dsp.r[DSP_REG_SR] & SR_MUL_MODIFY)?1:2;
|
||||
//}
|
||||
|
||||
//inline bool isCarry() {
|
||||
// return (g_dsp.r[DSP_REG_SR] & SR_CARRY) ? true : false;
|
||||
//}
|
||||
|
||||
//inline bool isOverflow() {
|
||||
// return (g_dsp.r[DSP_REG_SR] & SR_OVERFLOW) ? true : false;
|
||||
//}
|
||||
|
||||
//inline bool isOverS32() {
|
||||
// return (g_dsp.r[DSP_REG_SR] & SR_OVER_S32) ? true : false;
|
||||
//}
|
||||
|
||||
//inline bool isLess() {
|
||||
// return (!(g_dsp.r[DSP_REG_SR] & SR_OVERFLOW) != !(g_dsp.r[DSP_REG_SR] & SR_SIGN));
|
||||
//}
|
||||
|
||||
//inline bool isZero() {
|
||||
// return (g_dsp.r[DSP_REG_SR] & SR_ARITH_ZERO) ? true : false;
|
||||
//}
|
||||
|
||||
//inline bool isLogicZero() {
|
||||
// return (g_dsp.r[DSP_REG_SR] & SR_LOGIC_ZERO) ? true : false;
|
||||
//}
|
||||
|
||||
//inline bool isConditionA() {
|
||||
// return (((g_dsp.r[DSP_REG_SR] & SR_OVER_S32) || (g_dsp.r[DSP_REG_SR] & SR_TOP2BITS)) && !(g_dsp.r[DSP_REG_SR] & SR_ARITH_ZERO)) ? true : false;
|
||||
//}
|
||||
|
||||
//see DSPCore.h for flags
|
||||
//bool CheckCondition(u8 _Condition)
|
||||
//{
|
||||
// switch (_Condition & 0xf)
|
||||
// {
|
||||
// case 0xf: // Always true.
|
||||
// return true;
|
||||
// case 0x0: // GE - Greater Equal
|
||||
// return !isLess();
|
||||
// case 0x1: // L - Less
|
||||
// return isLess();
|
||||
// case 0x2: // G - Greater
|
||||
// return !isLess() && !isZero();
|
||||
// case 0x3: // LE - Less Equal
|
||||
// return isLess() || isZero();
|
||||
// case 0x4: // NZ - Not Zero
|
||||
// return !isZero();
|
||||
// case 0x5: // Z - Zero
|
||||
// return isZero();
|
||||
// case 0x6: // NC - Not carry
|
||||
// return !isCarry();
|
||||
// case 0x7: // C - Carry
|
||||
// return isCarry();
|
||||
// case 0x8: // ? - Not over s32
|
||||
// return !isOverS32();
|
||||
// case 0x9: // ? - Over s32
|
||||
// return isOverS32();
|
||||
// case 0xa: // ?
|
||||
// return isConditionA();
|
||||
// case 0xb: // ?
|
||||
// return !isConditionA();
|
||||
// case 0xc: // LNZ - Logic Not Zero
|
||||
// return !isLogicZero();
|
||||
// case 0xd: // LZ - Logic Zero
|
||||
// return isLogicZero();
|
||||
// case 0xe: // 0 - Overflow
|
||||
// return isOverflow();
|
||||
// default:
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -115,7 +115,8 @@ void DSPEmitter::l(const UDSPInstruction opc)
|
|||
|
||||
pushExtValueFromMem(dreg, sreg);
|
||||
|
||||
if (dreg >= DSP_REG_ACM0) {
|
||||
if (dreg >= DSP_REG_ACM0)
|
||||
{
|
||||
//save SR too, so we can decide later.
|
||||
//even if only for one bit, can only
|
||||
//store (up to) two registers in EBX,
|
||||
|
@ -139,7 +140,8 @@ void DSPEmitter::ln(const UDSPInstruction opc)
|
|||
|
||||
pushExtValueFromMem(dreg, sreg);
|
||||
|
||||
if (dreg >= DSP_REG_ACM0) {
|
||||
if (dreg >= DSP_REG_ACM0)
|
||||
{
|
||||
//save SR too, so we can decide later.
|
||||
//even if only for one bit, can only
|
||||
//store (up to) two registers in EBX,
|
||||
|
|
|
@ -263,7 +263,8 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
|
|||
}
|
||||
|
||||
// sync the freely used xregs
|
||||
if (!emit) {
|
||||
if (!emit)
|
||||
{
|
||||
for (i = 0; i < NUMXREGS; i++)
|
||||
{
|
||||
if (cache.xregs[i].guest_reg == DSP_REG_USED &&
|
||||
|
@ -501,7 +502,8 @@ void DSPJitRegCache::pushRegs()
|
|||
emitter.MOV(64, R(RBP), M(&ebp_store));
|
||||
}
|
||||
|
||||
void DSPJitRegCache::popRegs() {
|
||||
void DSPJitRegCache::popRegs()
|
||||
{
|
||||
emitter.MOV(64, M(&ebp_store), R(RBP));
|
||||
int push_count = 0;
|
||||
for (X64CachedReg& xreg : xregs)
|
||||
|
|
|
@ -103,13 +103,16 @@ void PrintCallstack()
|
|||
{
|
||||
printf("== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]);
|
||||
|
||||
if (LR == 0) {
|
||||
if (LR == 0)
|
||||
{
|
||||
printf(" LR = 0 - this is bad");
|
||||
}
|
||||
|
||||
if (g_symbolDB.GetDescription(PC) != g_symbolDB.GetDescription(LR))
|
||||
{
|
||||
printf(" * %s [ LR = %08x ]", g_symbolDB.GetDescription(LR).c_str(), LR);
|
||||
}
|
||||
|
||||
WalkTheStack([](u32 func_addr) {
|
||||
std::string func_desc = g_symbolDB.GetDescription(func_addr);
|
||||
if (func_desc.empty() || func_desc == "Invalid")
|
||||
|
@ -123,14 +126,17 @@ void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
|
|||
GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==",
|
||||
PowerPC::ppcState.gpr[1]);
|
||||
|
||||
if (LR == 0) {
|
||||
if (LR == 0)
|
||||
{
|
||||
GENERIC_LOG(type, level, " LR = 0 - this is bad");
|
||||
}
|
||||
|
||||
if (g_symbolDB.GetDescription(PC) != g_symbolDB.GetDescription(LR))
|
||||
{
|
||||
GENERIC_LOG(type, level, " * %s [ LR = %08x ]",
|
||||
g_symbolDB.GetDescription(LR).c_str(), LR);
|
||||
}
|
||||
|
||||
WalkTheStack([type, level](u32 func_addr) {
|
||||
std::string func_desc = g_symbolDB.GetDescription(func_addr);
|
||||
if (func_desc.empty() || func_desc == "Invalid")
|
||||
|
|
|
@ -28,9 +28,11 @@ public:
|
|||
virtual void ToggleMemCheck(unsigned int address) override;
|
||||
virtual unsigned int ReadMemory(unsigned int address) override;
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
EXTRAMEM_ARAM = 1,
|
||||
};
|
||||
|
||||
virtual unsigned int ReadExtraMemory(int memory, unsigned int address) override;
|
||||
virtual unsigned int ReadInstruction(unsigned int address) override;
|
||||
virtual unsigned int GetPC() override;
|
||||
|
|
|
@ -76,7 +76,8 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg)
|
|||
{
|
||||
char* pArgument = ArgumentBuffer;
|
||||
*pArgument++ = *pString++;
|
||||
if (*pString == '%') {
|
||||
if (*pString == '%')
|
||||
{
|
||||
_rOutBuffer += "%";
|
||||
pString++;
|
||||
continue;
|
||||
|
|
|
@ -269,7 +269,8 @@ void Shutdown()
|
|||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
{
|
||||
// Declare all the boilerplate direct MMIOs.
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
u32 addr;
|
||||
u16* ptr;
|
||||
bool align_writes_on_32_bytes;
|
||||
|
|
|
@ -82,7 +82,8 @@ u32 DSPHLE::DSP_UpdateRate()
|
|||
|
||||
void DSPHLE::SendMailToDSP(u32 _uMail)
|
||||
{
|
||||
if (m_pUCode != nullptr) {
|
||||
if (m_pUCode != nullptr)
|
||||
{
|
||||
DEBUG_LOG(DSP_MAIL, "CPU writes 0x%08x", _uMail);
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,8 @@ void AXWiiUCode::SetupProcessing(u32 init_addr)
|
|||
init_data[i] = HLEMemory_Read_U16(init_addr + 2 * i);
|
||||
|
||||
// List of all buffers we have to initialize
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
int* ptr;
|
||||
u32 samples;
|
||||
} buffers[] = {
|
||||
|
|
|
@ -62,7 +62,8 @@ void ROMUCode::HandleMail(u32 mail)
|
|||
|
||||
case 0x80F3B002:
|
||||
m_current_ucode.m_dmem_length = mail & 0xffff;
|
||||
if (m_current_ucode.m_dmem_length) {
|
||||
if (m_current_ucode.m_dmem_length)
|
||||
{
|
||||
NOTICE_LOG(DSPHLE,"m_current_ucode.m_dmem_length = 0x%04x.", m_current_ucode.m_dmem_length);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -22,7 +22,9 @@ void ZeldaUCode::AFCdecodebuffer(const s16 *coef, const char *src, signed short
|
|||
nibbles[i + 1] = *src & 15;
|
||||
src++;
|
||||
}
|
||||
for (auto& nibble : nibbles) {
|
||||
|
||||
for (auto& nibble : nibbles)
|
||||
{
|
||||
if (nibble >= 8)
|
||||
nibble = nibble - 16;
|
||||
nibble <<= 11;
|
||||
|
|
|
@ -464,7 +464,8 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer)
|
|||
const u8 *source = Memory::GetPointer(0x80000000);
|
||||
const u16 *src = (u16 *)(source + (ACC0 & ram_mask));
|
||||
|
||||
for (u32 i = 0; i < (ACC1 >> 16); i++) {
|
||||
for (u32 i = 0; i < (ACC1 >> 16); i++)
|
||||
{
|
||||
_Buffer[i] = Common::swap16(src[i]);
|
||||
}
|
||||
|
||||
|
@ -484,7 +485,8 @@ void ZeldaUCode::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightB
|
|||
}
|
||||
|
||||
// XK: Use this to disable MIDI music (GREAT for testing). Also kills some sound FX.
|
||||
//if (PB.SoundType == 0x0d00) {
|
||||
//if (PB.SoundType == 0x0d00)
|
||||
//{
|
||||
// PB.NeedsReset = 0;
|
||||
// return;
|
||||
//}
|
||||
|
@ -592,13 +594,15 @@ ContinueWithBlock:
|
|||
if (PB.VolumeMode != 0)
|
||||
{
|
||||
// Complex volume mode. Let's see what we can do.
|
||||
if (PB.StopOnSilence) {
|
||||
if (PB.StopOnSilence)
|
||||
{
|
||||
PB.raw[0x2b] = PB.raw[0x2a] >> 1;
|
||||
if (PB.raw[0x2b] == 0)
|
||||
{
|
||||
PB.KeyOff = 1;
|
||||
}
|
||||
}
|
||||
|
||||
short AX0L = PB.raw[0x28] >> 8;
|
||||
short AX0H = PB.raw[0x28] & 0x7F;
|
||||
short AX1L = AX0L ^ 0x7F;
|
||||
|
@ -651,7 +655,8 @@ ContinueWithBlock:
|
|||
for (int i = 0; i < _Size; i++)
|
||||
{
|
||||
int unmixed_audio = m_voice_buffer[i];
|
||||
switch (count) {
|
||||
switch (count)
|
||||
{
|
||||
case 0: _LeftBuffer[i] += (u64)unmixed_audio * ramp >> 29; break;
|
||||
case 1: _RightBuffer[i] += (u64)unmixed_audio * ramp >> 29; break;
|
||||
}
|
||||
|
@ -731,7 +736,8 @@ ContinueWithBlock:
|
|||
}
|
||||
}
|
||||
// 03b2, this is the reason of using PB.NeedsReset. Seems to be necessary for SMG, and maybe other games.
|
||||
if (PB.IsBlank == 0){
|
||||
if (PB.IsBlank == 0)
|
||||
{
|
||||
PB.NeedsReset = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,7 +155,10 @@ enum
|
|||
BBA_MEM_SIZE = BBA_NUM_PAGES * BBA_PAGE_SIZE
|
||||
};
|
||||
|
||||
enum { EXI_DEVTYPE_ETHER = 0x04020200 };
|
||||
enum
|
||||
{
|
||||
EXI_DEVTYPE_ETHER = 0x04020200
|
||||
};
|
||||
|
||||
enum SendStatus
|
||||
{
|
||||
|
|
|
@ -105,7 +105,8 @@ struct GCMBlock
|
|||
void calc_checksumsBE(u16 *buf, u32 length, u16 *csum, u16 *inv_csum);
|
||||
|
||||
#pragma pack(push,1)
|
||||
struct Header { //Offset Size Description
|
||||
struct Header //Offset Size Description
|
||||
{
|
||||
// Serial in libogc
|
||||
u8 serial[12]; //0x0000 12 ?
|
||||
u64 formatTime; //0x000c 8 Time of format (OSTime value)
|
||||
|
|
|
@ -70,10 +70,13 @@ static u32 EFB_Read(const u32 addr)
|
|||
int x = (addr & 0xfff) >> 2;
|
||||
int y = (addr >> 12) & 0x3ff;
|
||||
|
||||
if (addr & 0x00400000) {
|
||||
if (addr & 0x00400000)
|
||||
{
|
||||
var = g_video_backend->Video_AccessEFB(PEEK_Z, x, y, 0);
|
||||
DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i\t= 0x%08x", x, y, var);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
var = g_video_backend->Video_AccessEFB(PEEK_COLOR, x, y, 0);
|
||||
DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i\t= 0x%08x", x, y, var);
|
||||
}
|
||||
|
@ -378,7 +381,8 @@ void Write_U16(const u16 _Data, const u32 _Address)
|
|||
|
||||
WriteToHardware<u16>(_Address, _Data, _Address, FLAG_WRITE);
|
||||
}
|
||||
void Write_U16_Swap(const u16 _Data, const u32 _Address) {
|
||||
void Write_U16_Swap(const u16 _Data, const u32 _Address)
|
||||
{
|
||||
Write_U16(Common::swap16(_Data), _Address);
|
||||
}
|
||||
|
||||
|
@ -413,7 +417,8 @@ void Write_U64(const u64 _Data, const u32 _Address)
|
|||
|
||||
WriteToHardware<u64>(_Address, _Data, _Address + 4, FLAG_WRITE);
|
||||
}
|
||||
void Write_U64_Swap(const u64 _Data, const u32 _Address) {
|
||||
void Write_U64_Swap(const u64 _Data, const u32 _Address)
|
||||
{
|
||||
Write_U64(Common::swap64(_Data), _Address);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ distribution.
|
|||
union SRAM
|
||||
{
|
||||
u8 p_SRAM[64];
|
||||
struct { // Stored configuration value from the system SRAM area
|
||||
struct // Stored configuration value from the system SRAM area
|
||||
{
|
||||
u16 checksum; // Holds the block checksum.
|
||||
u16 checksum_inv; // Holds the inverse block checksum
|
||||
u32 ead0; // Unknown attribute
|
||||
|
|
|
@ -70,7 +70,8 @@ struct CtrlRegister
|
|||
inline u8 ppc() { return (IY2<<5)|(IY1<<4)|(X2<<3)|(Y1<<2)|(Y2<<1)|X1; }
|
||||
inline u8 arm() { return (IX2<<5)|(IX1<<4)|(Y2<<3)|(X1<<2)|(X2<<1)|Y1; }
|
||||
|
||||
inline void ppc(u32 v) {
|
||||
inline void ppc(u32 v)
|
||||
{
|
||||
X1 = v & 1;
|
||||
X2 = (v >> 3) & 1;
|
||||
if ((v >> 2) & 1) Y1 = 0;
|
||||
|
@ -79,7 +80,8 @@ struct CtrlRegister
|
|||
IY2 = (v >> 5) & 1;
|
||||
}
|
||||
|
||||
inline void arm(u32 v) {
|
||||
inline void arm(u32 v)
|
||||
{
|
||||
Y1 = v & 1;
|
||||
Y2 = (v >> 3) & 1;
|
||||
if ((v >> 2) & 1) X1 = 0;
|
||||
|
|
|
@ -74,7 +74,8 @@ void Nunchuk::GetState(u8* const data)
|
|||
cal_js[0] = cal.jx;
|
||||
cal_js[1] = cal.jy;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
double &s = state[i];
|
||||
nu_js c = cal_js[i];
|
||||
if (s < 0)
|
||||
|
|
|
@ -115,8 +115,8 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
|||
case WM_SPACE_EEPROM:
|
||||
if (logCom) Name.append(" REG_EEPROM"); break;
|
||||
case WM_SPACE_REGS1:
|
||||
case WM_SPACE_REGS2: {
|
||||
|
||||
case WM_SPACE_REGS2:
|
||||
{
|
||||
const u8 region_offset = (u8)address;
|
||||
void *region_ptr = nullptr;
|
||||
int region_size = 0;
|
||||
|
@ -148,7 +148,8 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
|||
case 0xa4:
|
||||
if (logCom) Name.append(" REG_EXT");
|
||||
// Update the encryption mode
|
||||
if (data[5] == 0xf0) {
|
||||
if (data[5] == 0xf0)
|
||||
{
|
||||
if (!emu)
|
||||
wm->m_reg_ext.encryption = wd->data[0];
|
||||
//NOTICE_LOG(CONSOLE, "Extension encryption: %u", wm->m_reg_ext.encryption);
|
||||
|
@ -158,7 +159,8 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
|||
case 0xa6 :
|
||||
if (logCom) Name.append(" REG_M+");
|
||||
// update the encryption mode
|
||||
if (data[5] == 0xf0) {
|
||||
if (data[5] == 0xf0)
|
||||
{
|
||||
if (!emu)
|
||||
wm->m_reg_motion_plus.activated = wd->data[0];
|
||||
//NOTICE_LOG(CONSOLE, "Extension enryption: %u", wm->m_reg_ext.encryption);
|
||||
|
@ -173,12 +175,14 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
|||
if (!emu && region_ptr)
|
||||
memcpy((u8*)region_ptr + region_offset, wd->data, wd->size);
|
||||
// save key
|
||||
if (region_offset >= 0x40 && region_offset <= 0x4c) {
|
||||
if (region_offset >= 0x40 && region_offset <= 0x4c)
|
||||
{
|
||||
if (!emu)
|
||||
WiimoteGenerateKey(&wm->m_ext_key, wm->m_reg_ext.encryption_key);
|
||||
INFO_LOG(CONSOLE, "Writing key: %s", ArrayToString((u8*)&wm->m_ext_key, sizeof(wm->m_ext_key), 0, 30).c_str());
|
||||
}
|
||||
if (data[3] == 0xa4 || data[3] == 0xa6) {
|
||||
if (data[3] == 0xa4 || data[3] == 0xa6)
|
||||
{
|
||||
//DEBUG_LOG(CONSOLE, "M+: %s", ArrayToString((u8*)&wm->m_reg_motion_plus, sizeof(wm->m_reg_motion_plus), 0, 30).c_str());
|
||||
//DEBUG_LOG(CONSOLE, "M+: %s", ArrayToString((u8*)&wm->m_reg_motion_plus.ext_identifier, sizeof(wm->m_reg_motion_plus.ext_identifier), 0, 30).c_str());
|
||||
NOTICE_LOG(CONSOLE, "W[0x%02x 0x%02x|%d]: %s", data[3], region_offset, wd->size, ArrayToString(wd->data, wd->size, 0).c_str());
|
||||
|
@ -315,8 +319,10 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_)
|
|||
if (logCom)
|
||||
Name.append(" REG_EEPROM");
|
||||
// Wiimote calibration
|
||||
if (data[4] == 0xf0 && data[5] == 0x00 && data[6] == 0x10) {
|
||||
if (data[6] == 0x10) {
|
||||
if (data[4] == 0xf0 && data[5] == 0x00 && data[6] == 0x10)
|
||||
{
|
||||
if (data[6] == 0x10)
|
||||
{
|
||||
accel_cal* calib = (accel_cal*)&rdr->data[6];
|
||||
ERROR_LOG(CONSOLE, "Wiimote calibration:");
|
||||
//SERROR_LOG(CONSOLE, "%s", ArrayToString(rdr->data, rdr->size).c_str());
|
||||
|
|
|
@ -576,7 +576,8 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
|
|||
File::IOFile handle(entry.physicalName, "rb");
|
||||
char buf[65536];
|
||||
u32 count = size;
|
||||
while (count > 65536) {
|
||||
while (count > 65536)
|
||||
{
|
||||
handle.ReadArray(&buf[0], 65536);
|
||||
p.DoArray(&buf[0], 65536);
|
||||
count -= 65536;
|
||||
|
|
|
@ -27,7 +27,8 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
|||
if (timeToFill == 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(hid->m_device_list_reply_mutex);
|
||||
if (hid->deviceCommandAddress != 0){
|
||||
if (hid->deviceCommandAddress != 0)
|
||||
{
|
||||
hid->FillOutDevices(Memory::Read_U32(hid->deviceCommandAddress + 0x18), Memory::Read_U32(hid->deviceCommandAddress + 0x1C));
|
||||
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
|
@ -240,7 +241,8 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
case IOCTL_HID_SHUTDOWN:
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(m_device_list_reply_mutex);
|
||||
if (deviceCommandAddress != 0){
|
||||
if (deviceCommandAddress != 0)
|
||||
{
|
||||
Memory::Write_U32(0xFFFFFFFF, Memory::Read_U32(deviceCommandAddress + 0x18));
|
||||
|
||||
// The original hardware overwrites the command type with the async reply type.
|
||||
|
|
|
@ -785,7 +785,8 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
|
|||
optval[15], optval[16], optval[17], optval[18], optval[19]);
|
||||
|
||||
//TODO: bug booto about this, 0x2005 most likely timeout related, default value on wii is , 0x2001 is most likely tcpnodelay
|
||||
if (level == 6 && (optname == 0x2005 || optname == 0x2001)){
|
||||
if (level == 6 && (optname == 0x2005 || optname == 0x2001))
|
||||
{
|
||||
ReturnValue = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -422,7 +422,8 @@ private:
|
|||
IOCTL_NWC24_REQUEST_SHUTDOWN = 0x28,
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
MODEL_RVT = 0,
|
||||
MODEL_RVV = 0,
|
||||
MODEL_RVL = 1,
|
||||
|
|
|
@ -261,7 +261,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
|
|||
}
|
||||
|
||||
u32 ReturnValue = 0;
|
||||
switch (CommandBuffer.Parameter) {
|
||||
switch (CommandBuffer.Parameter)
|
||||
{
|
||||
case IOCTLV_SENDCMD:
|
||||
INFO_LOG(WII_IPC_SD, "IOCTLV_SENDCMD 0x%08x", Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address));
|
||||
ReturnValue = ExecuteCommand(
|
||||
|
@ -288,7 +289,8 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
|
|||
{
|
||||
// The game will send us a SendCMD with this information. To be able to read and write
|
||||
// to a file we need to prepare a 0x10 byte output buffer as response.
|
||||
struct Request {
|
||||
struct Request
|
||||
{
|
||||
u32 command;
|
||||
u32 type;
|
||||
u32 resp;
|
||||
|
|
|
@ -33,7 +33,8 @@ private:
|
|||
u8 Unk2;
|
||||
u8 PressedKeys[6];
|
||||
|
||||
SMessageData(u32 _MsgType, u8 _Modifiers, u8 *_PressedKeys) {
|
||||
SMessageData(u32 _MsgType, u8 _Modifiers, u8 *_PressedKeys)
|
||||
{
|
||||
MsgType = Common::swap32(_MsgType);
|
||||
Unk1 = 0; // swapped
|
||||
Modifiers = _Modifiers;
|
||||
|
|
|
@ -64,9 +64,12 @@ static s32 TranslateErrorCode(s32 native_error, bool isRW)
|
|||
case ERRORCODE(EHOSTUNREACH):
|
||||
return -SO_EHOSTUNREACH;
|
||||
case EITHER(WSAEWOULDBLOCK, EAGAIN):
|
||||
if (isRW){
|
||||
if (isRW)
|
||||
{
|
||||
return -SO_EAGAIN; // EAGAIN
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
return -SO_EINPROGRESS; // EINPROGRESS
|
||||
}
|
||||
default:
|
||||
|
@ -473,7 +476,8 @@ void WiiSocket::Update(bool read, bool write, bool except)
|
|||
// recv/recvfrom only handles PEEK/OOB
|
||||
flags &= SO_MSG_PEEK | SO_MSG_OOB;
|
||||
#ifdef _WIN32
|
||||
if (flags & SO_MSG_PEEK){
|
||||
if (flags & SO_MSG_PEEK)
|
||||
{
|
||||
unsigned long totallen = 0;
|
||||
ioctlsocket(fd, FIONREAD, &totallen);
|
||||
ReturnValue = totallen;
|
||||
|
|
|
@ -52,12 +52,15 @@ typedef struct pollfd pollfd_t;
|
|||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
SO_MSG_OOB = 0x01,
|
||||
SO_MSG_PEEK = 0x02,
|
||||
SO_MSG_NONBLOCK = 0x04,
|
||||
};
|
||||
enum {
|
||||
|
||||
enum
|
||||
{
|
||||
SO_SUCCESS,
|
||||
SO_E2BIG = 1,
|
||||
SO_EACCES,
|
||||
|
|
|
@ -733,7 +733,8 @@ bool PlayInput(const std::string& filename)
|
|||
if (tmpHeader.filetype[0] != 'D' ||
|
||||
tmpHeader.filetype[1] != 'T' ||
|
||||
tmpHeader.filetype[2] != 'M' ||
|
||||
tmpHeader.filetype[3] != 0x1A) {
|
||||
tmpHeader.filetype[3] != 0x1A)
|
||||
{
|
||||
PanicAlertT("Invalid recording file");
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
@ -480,7 +480,8 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
// WARNING - cmp->branch merging will screw this up.
|
||||
js.isLastInstruction = true;
|
||||
js.next_inst = 0;
|
||||
if (Profiler::g_ProfileBlocks) {
|
||||
if (Profiler::g_ProfileBlocks)
|
||||
{
|
||||
// CAUTION!!! push on stack regs you use, do your stuff, then pop
|
||||
PROFILER_VPUSH;
|
||||
// get end tic
|
||||
|
|
|
@ -375,9 +375,11 @@ void CompileInstruction(PPCAnalyst::CodeOp & op)
|
|||
Jit64 *jit64 = (Jit64 *)jit;
|
||||
(jit64->*dynaOpTable[op.inst.OPCD])(op.inst);
|
||||
GekkoOPInfo *info = op.opinfo;
|
||||
if (info) {
|
||||
if (info)
|
||||
{
|
||||
#ifdef OPLOG
|
||||
if (!strcmp(info->opname, OP_TO_LOG)){ ///"mcrfs"
|
||||
if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs"
|
||||
{
|
||||
rsplocations.push_back(jit.js.compilerPC);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -174,7 +174,8 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void)
|
|||
|
||||
InstructionInfo info = {};
|
||||
|
||||
if (!DisassembleMov(codePtr, &info)) {
|
||||
if (!DisassembleMov(codePtr, &info))
|
||||
{
|
||||
BackPatchError("BackPatch - failed to disassemble MOV instruction", codePtr, emAddress);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,8 @@ bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size)
|
|||
}
|
||||
}
|
||||
/*
|
||||
else if ((instr.hex & 0xFC000000) == (0x4b000000 & 0xFC000000) && !instr.LK) {
|
||||
else if ((instr.hex & 0xFC000000) == (0x4b000000 & 0xFC000000) && !instr.LK)
|
||||
{
|
||||
u32 target = addr + SignExt26(instr.LI << 2);
|
||||
if (target < startAddr || (max_size && target > max_size+startAddr))
|
||||
{
|
||||
|
@ -415,7 +416,8 @@ void PPCAnalyzer::ReorderInstructions(u32 instructions, CodeOp *code)
|
|||
(a.inst.OPCD == 31 && (a.inst.SUBOP10 == 0 || a.inst.SUBOP10 == 32)))
|
||||
{
|
||||
// Got a compare instruction.
|
||||
if (CanSwapAdjacentOps(a, b)) {
|
||||
if (CanSwapAdjacentOps(a, b))
|
||||
{
|
||||
// Alright, let's bubble it down!
|
||||
CodeOp c = a;
|
||||
a = b;
|
||||
|
@ -626,7 +628,8 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32
|
|||
{
|
||||
// mtspr
|
||||
const u32 index = (inst.SPRU << 5) | (inst.SPRL & 0x1F);
|
||||
if (index == SPR_LR) {
|
||||
if (index == SPR_LR)
|
||||
{
|
||||
// We give up to follow the return address
|
||||
// because we have to check the register usage.
|
||||
return_address = 0;
|
||||
|
|
|
@ -63,9 +63,11 @@ struct BlockRegStats
|
|||
bool anyTimer;
|
||||
|
||||
int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];}
|
||||
int GetUseRange(int reg) {
|
||||
int GetUseRange(int reg)
|
||||
{
|
||||
return std::max(lastRead[reg], lastWrite[reg]) -
|
||||
std::min(firstRead[reg], firstWrite[reg]);}
|
||||
std::min(firstRead[reg], firstWrite[reg]);
|
||||
}
|
||||
|
||||
inline void SetInputRegister(int reg, short opindex)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,8 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
|
|||
tf.name = name;
|
||||
tf.type = type;
|
||||
tf.address = startAddr;
|
||||
if (tf.type == Symbol::SYMBOL_FUNCTION) {
|
||||
if (tf.type == Symbol::SYMBOL_FUNCTION)
|
||||
{
|
||||
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
|
||||
checksumToFunction[tf.hash] = &(functions[startAddr]);
|
||||
}
|
||||
|
|
|
@ -198,7 +198,8 @@ inline void SetCRField(int cr_field, int value)
|
|||
PowerPC::ppcState.cr_val[cr_field] = m_crTable[value];
|
||||
}
|
||||
|
||||
inline u32 GetCRField(int cr_field) {
|
||||
inline u32 GetCRField(int cr_field)
|
||||
{
|
||||
u64 cr_val = PowerPC::ppcState.cr_val[cr_field];
|
||||
u32 ppc_cr = 0;
|
||||
|
||||
|
@ -214,11 +215,13 @@ inline u32 GetCRField(int cr_field) {
|
|||
return ppc_cr;
|
||||
}
|
||||
|
||||
inline u32 GetCRBit(int bit) {
|
||||
inline u32 GetCRBit(int bit)
|
||||
{
|
||||
return (GetCRField(bit >> 2) >> (3 - (bit & 3))) & 1;
|
||||
}
|
||||
|
||||
inline void SetCRBit(int bit, int value) {
|
||||
inline void SetCRBit(int bit, int value)
|
||||
{
|
||||
if (value & 1)
|
||||
SetCRField(bit >> 2, GetCRField(bit >> 2) | (0x8 >> (bit & 3)));
|
||||
else
|
||||
|
@ -226,36 +229,44 @@ inline void SetCRBit(int bit, int value) {
|
|||
}
|
||||
|
||||
// SetCR and GetCR are fairly slow. Should be avoided if possible.
|
||||
inline void SetCR(u32 new_cr) {
|
||||
inline void SetCR(u32 new_cr)
|
||||
{
|
||||
PowerPC::ExpandCR(new_cr);
|
||||
}
|
||||
|
||||
inline u32 GetCR() {
|
||||
inline u32 GetCR()
|
||||
{
|
||||
return PowerPC::CompactCR();
|
||||
}
|
||||
|
||||
// SetCarry/GetCarry may speed up soon.
|
||||
inline void SetCarry(int ca) {
|
||||
inline void SetCarry(int ca)
|
||||
{
|
||||
((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]).CA = ca;
|
||||
}
|
||||
|
||||
inline int GetCarry() {
|
||||
inline int GetCarry()
|
||||
{
|
||||
return ((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]).CA;
|
||||
}
|
||||
|
||||
inline UReg_XER GetXER() {
|
||||
inline UReg_XER GetXER()
|
||||
{
|
||||
return ((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]);
|
||||
}
|
||||
|
||||
inline void SetXER(UReg_XER new_xer) {
|
||||
inline void SetXER(UReg_XER new_xer)
|
||||
{
|
||||
((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]) = new_xer;
|
||||
}
|
||||
|
||||
inline int GetXER_SO() {
|
||||
inline int GetXER_SO()
|
||||
{
|
||||
return ((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]).SO;
|
||||
}
|
||||
|
||||
inline void SetXER_SO(int value) {
|
||||
inline void SetXER_SO(int value)
|
||||
{
|
||||
((UReg_XER&)PowerPC::ppcState.spr[SPR_XER]).SO = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,12 +66,16 @@ private:
|
|||
u8 boot1_hash [ 0x14]; // 0x100
|
||||
u8 common_key [ 0x10]; // 0x114
|
||||
u32 ng_id; // 0x124
|
||||
union {
|
||||
struct {
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
u8 ng_priv [ 0x1e]; // 0x128
|
||||
u8 pad1 [ 0x12];
|
||||
};
|
||||
struct {
|
||||
|
||||
struct
|
||||
{
|
||||
u8 pad2 [ 0x1c];
|
||||
u8 nand_hmac [ 0x14]; //0x144
|
||||
};
|
||||
|
|
|
@ -39,9 +39,11 @@ static bool DoFault(u64 bad_address, SContext *ctx)
|
|||
0x40000000;
|
||||
#endif
|
||||
|
||||
if (bad_address < memspace_bottom || bad_address >= memspace_top) {
|
||||
if (bad_address < memspace_bottom || bad_address >= memspace_top)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 em_address = (u32)(bad_address - memspace_bottom);
|
||||
const u8 *new_pc = jit->BackPatch((u8*) ctx->CTX_PC, em_address, ctx);
|
||||
if (new_pc)
|
||||
|
|
Loading…
Reference in New Issue