Updated lazyusf
parent
2a0ef29ebe
commit
42e6eb03c2
|
@ -55,6 +55,13 @@ _HLE_Entry entrys[] = {
|
|||
|
||||
//char foundlist[2048];
|
||||
|
||||
int sort_entrys(void * a, void * b)
|
||||
{
|
||||
_HLE_Entry * _a = (_HLE_Entry *)a;
|
||||
_HLE_Entry * _b = (_HLE_Entry *)b;
|
||||
return _b->used - _a->used;
|
||||
}
|
||||
|
||||
int CPUHLE_Scan(usf_state_t * state)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
|
@ -65,6 +72,7 @@ int CPUHLE_Scan(usf_state_t * state)
|
|||
void * address = 0;
|
||||
int good = 1; //, needcomma = 0;
|
||||
_HLE_Entry * entries;
|
||||
unsigned entries_used = 0;
|
||||
|
||||
numEntries = sizeof(entrys) / sizeof(_HLE_Entry);
|
||||
|
||||
|
@ -111,12 +119,16 @@ int CPUHLE_Scan(usf_state_t * state)
|
|||
|
||||
entries[entry].used = 1;
|
||||
entries[entry].phys = i;
|
||||
++entries_used;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qsort(entries, numEntries, sizeof(*entries), sort_entrys);
|
||||
state->cpu_hle_entry_count = entries_used;
|
||||
|
||||
//printf("<--------------HLE Functions Found--------------->\n%s<------------------------------------------------>\n", foundlist);
|
||||
//printf("HLE Functions found: %s\n", foundlist);
|
||||
|
||||
|
@ -128,10 +140,11 @@ int DoCPUHLE(usf_state_t * state, unsigned long loc)
|
|||
int i = 0;
|
||||
uintptr_t real_addr = PageVRAM2(loc);
|
||||
_HLE_Entry * entries = state->cpu_hle_entries;
|
||||
unsigned numEntries = state->cpu_hle_entry_count;
|
||||
|
||||
for(i = 0; i < numEntries; i++) {
|
||||
|
||||
if(entries[i].used && (entries[i].phys == real_addr)) {
|
||||
if(entries[i].phys == real_addr) {
|
||||
//printf("CPU HLEing using %d at %08x (phys: %08x) \"%s\"\n", entries[i].name, loc, entries[i].phys, entries[i].name);
|
||||
|
||||
if(entries[i].location(state, entries[i].phys)) {
|
||||
|
|
|
@ -737,16 +737,17 @@ void ExecuteInterpreterOpCode (usf_state_t * state) {
|
|||
state->PROGRAM_COUNTER += 4;
|
||||
break;
|
||||
case JUMP:
|
||||
if(!DoCPUHLE(state, state->JumpToLocation)) {
|
||||
state->PROGRAM_COUNTER = state->JumpToLocation;
|
||||
state->NextInstruction = NORMAL;
|
||||
} else {
|
||||
if (state->cpu_hle_entry_count &&
|
||||
DoCPUHLE(state, state->JumpToLocation)) {
|
||||
state->PROGRAM_COUNTER = state->GPR[31].UW[0];
|
||||
state->NextInstruction = NORMAL;
|
||||
}
|
||||
if ((int32_t)state->Timers->Timer < 0) { TimerDone(state); }
|
||||
else {
|
||||
state->PROGRAM_COUNTER = state->JumpToLocation;
|
||||
state->NextInstruction = NORMAL;
|
||||
}
|
||||
if ((int32_t)state->Timers->Timer < 0) { TimerDone(state); }
|
||||
if (state->CPU_Action->DoSomething) { DoSomething(state); }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
#define ROM_IN_MAPSPACE
|
||||
|
||||
#define PageRAM2(x) (state->N64MEM+(x))
|
||||
#define PageVRAM(x) (state->TLB_Map[((x)&0xFFFFFFFF)>>12]+(x))
|
||||
#define PageRAM2(x) (state->N64MEM+(uint32_t)(x))
|
||||
#define PageVRAM(x) (state->TLB_Map[((uint32_t)(x))>>12]+(uint32_t)(x))
|
||||
#define PageVRAM2(x) (uint32_t)(PageVRAM(x)-(uintptr_t)state->N64MEM)
|
||||
|
||||
/* Memory Control */
|
||||
|
|
|
@ -138,6 +138,7 @@ struct usf_state
|
|||
|
||||
uint32_t OLD_VI_V_SYNC_REG/* = 0*/, VI_INTR_TIME/* = 500000*/;
|
||||
|
||||
uint32_t cpu_hle_entry_count;
|
||||
_HLE_Entry * cpu_hle_entries;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue