Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Aug 26, 2020
1 parent 8eed336 commit 58a0fb4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 36 deletions.
19 changes: 7 additions & 12 deletions Source/Core/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CHEAT_CODE_MAGIC_VALUE 0xDEAD

CODEGROUP *codegrouplist;
u32 codegroupcount {};
u32 codegroupcount = 0;
//*****************************************************************************
//
//*****************************************************************************
Expand Down Expand Up @@ -84,10 +84,10 @@ void CheatCodes_Apply(u32 index, u32 mode)
code++;
continue;
}
u32 address {(code->addr & 0xFFFFFF)};
u16 value {code->val};
u32 type {(code->addr >> 24) & 0xFF};
u8* p_mem {g_pu8RamBase + address}; // addr is already pre-swapped
u32 address = (code->addr & 0xFFFFFF);
u16 value = code->val;
u32 type = (code->addr >> 24) & 0xFF;
u8* p_mem = g_pu8RamBase + address; // addr is already pre-swapped

switch(type)
{
Expand Down Expand Up @@ -196,7 +196,7 @@ void CheatCodes_Apply(u32 index, u32 mode)
//*****************************************************************************
void CheatCodes_Activate( CHEAT_MODE mode )
{
for(u32 i {}; i < codegroupcount; i++)
for(u32 i = 0; i < codegroupcount; i++)
{
// Apply only activated cheats
if(codegrouplist[i].active)
Expand Down Expand Up @@ -405,7 +405,7 @@ bool CheatCodes_Read(const char *rom_name, const char *file, u8 countryID)
codegrouplist[codegroupcount].note[0] = '\0';
}

u32 addr {}, value {};
u32 addr = 0, value = 0;
codegrouplist[codegroupcount].active = (line[c1 + 1] - '0') ? true : false;
codegrouplist[codegroupcount].enable = false;
codegrouplist[codegroupcount].codecount = 0;
Expand Down Expand Up @@ -471,11 +471,6 @@ bool CheatCodes_Read(const char *rom_name, const char *file, u8 countryID)
codegroupcount++;
}
}
else
{
// Cannot find entry for the current rom
//printf("Cannot find entry %d groups of cheat code->n", codegroupcount);
}

fclose(stream);
return true;
Expand Down
15 changes: 4 additions & 11 deletions Source/Core/Dynamo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// These values are very sensitive to change in some games so be carefull!!! //Corn
// War God is sensitive to gHotTraceThreshold
// PD is sensitive to gMaxHotTraceMapSize
//
// Banjo Tooie needs a larger cache size
// BUT leave PSP cache size untouched for now
#ifdef DAEDALUS_PSP
#define TRACE_SIZE 512
#else
#define TRACE_SIZE 1024
#endif

static const u32 gMaxFragmentCacheSize {(8192 + 1024)}; //Maximum amount of fragments in the cache
static const u32 gMaxHotTraceMapSize {(2048 + TRACE_SIZE)};
static const u32 gHotTraceThreshold {10}; //How many times interpreter has to loop a trace before it becomes hot and sent to dynarec
static const u32 gMaxFragmentCacheSize = (8192 + 1024); //Maximum amount of fragments in the cache
static const u32 gMaxHotTraceMapSize = (2048 + TRACE_SIZE);
static const u32 gHotTraceThreshold = 10; //How many times interpreter has to loop a trace before it becomes hot and sent to dynarec

//typedef CMemoryPoolAllocator< std::pair< const u32, u32 > > MyAllocator;
//std::map< u32, u32, std::less<u32>, MyAllocator > gHotTraceCountMap;
//std::map< u32, u32, std::less<u32>, boost::pool_allocator<std::pair< const u32, u32 > > > gHotTraceCountMap;
std::map< u32, u32 > gHotTraceCountMap {};
CFragmentCache gFragmentCache {};
static bool gResetFragmentCache {false};
static bool gResetFragmentCache = false;

#ifdef DAEDALUS_DEBUG_DYNAREC
std::map< u32, u32 > gAbortedTraceReasons;
Expand Down
24 changes: 12 additions & 12 deletions Source/OSHLE/patch_gu_hle.inl
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
//Fixed point identity matrix
static const u32 s_IdentMatrixL[16] =
{
0x00010000, 0x00000000,
0x00000001, 0x00000000,
0x00000000, 0x00010000,
0x00000000, 0x00000001,
0x00010000, 0x00000000,
0x00000001, 0x00000000,
0x00000000, 0x00010000,
0x00000000, 0x00000001,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000
0x00000000, 0x00000000,
0x00000000, 0x00000000
};

//Floating point identity matrix
static const u32 s_IdentMatrixF[16] =
{
0x3f800000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x3f800000,
0x00000000, 0x00000000,
0x3f800000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x3f800000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x3f800000, 0x00000000,
0x3f800000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x3f800000
0x00000000, 0x3f800000
};

u32 Patch_guMtxIdentF()
Expand Down
2 changes: 1 addition & 1 deletion Source/SysVita/UI/MainMenuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ char *DrawRomSelector(bool skip_reloads) {
if (selected && !skip_reloads) {
cur_playtime = hovered->playtime;
last_launched = hovered;
CheatCodes_Read( hovered->title, "Daedalus.cht", hovered->id.CountryID );
CheatCodes_Read(hovered->title, "Daedalus.cht", hovered->id.CountryID);
return selectedRom;
}
return nullptr;
Expand Down

0 comments on commit 58a0fb4

Please sign in to comment.