remove tmbinc msec timer, replace with libogc usec timer. fix unfiltered mode.

This commit is contained in:
dborth 2009-05-12 06:59:05 +00:00
parent 2838765896
commit 6ed7f2e8ee
8 changed files with 11 additions and 83 deletions

View File

@ -17,9 +17,7 @@
#include <sys/stat.h>
#ifdef HW_RVL
extern "C" {
#include <di/di.h>
}
#endif
#include "vba.h"

View File

@ -1,15 +0,0 @@
#include "tbtime.h"
unsigned long
tb_diff_msec (tb_t * end, tb_t * start)
{
unsigned long upper, lower;
upper = end->u - start->u;
if (start->l > end->l)
upper--;
lower = end->l - start->l;
return ((upper * ((unsigned long) 0x80000000 / (TB_CLOCK / 2000))) +
(lower / (TB_CLOCK / 1000)));
}

View File

@ -1,26 +0,0 @@
/****************************************************************************
* tmbinc msec timer
****************************************************************************/
#ifndef __TMBINCTIMER__
#define __TMBINCTIMER__
#ifdef HW_RVL
#define TB_CLOCK 60750000 //WII
#else
#define TB_CLOCK 40500000
#endif
#define mftb(rval) ({unsigned long u; do { \
asm volatile ("mftbu %0" : "=r" (u)); \
asm volatile ("mftb %0" : "=r" ((rval)->l)); \
asm volatile ("mftbu %0" : "=r" ((rval)->u)); \
} while(u != ((rval)->u)); })
typedef struct
{
unsigned long l, u;
}
tb_t;
unsigned long tb_diff_msec (tb_t * end, tb_t * start);
#endif

View File

@ -17,9 +17,7 @@
#include <wiiuse/wpad.h>
#ifdef HW_RVL
extern "C" {
#include <di/di.h>
}
#endif
#include "FreeTypeGX.h"

View File

@ -34,7 +34,7 @@ void FixInvalidSettings()
GCSettings.MusicVolume = 40;
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
GCSettings.SFXVolume = 40;
if(!(GCSettings.render >= 0 && GCSettings.render < 2))
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 1;
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
GCSettings.videomode = 0;

View File

@ -15,6 +15,11 @@
#include <wiiuse/wpad.h>
#include <malloc.h>
extern "C" {
long long gettime();
u32 diff_usec(long long start,long long end);
}
#include "pngu/pngu.h"
#include "unzip.h"
@ -46,16 +51,7 @@
#include "gcunzip.h"
#include "gamesettings.h"
extern "C"
{
#include "tbtime.h"
long long gettime();
u32 diff_usec(long long start,long long end);
}
static tb_t start, now;
u32 loadtimeradjust;
static u32 start;
int cartridgeType = 0;
u32 RomIdCode;
int SunBars = 3;
@ -114,8 +110,8 @@ struct EmulatedSystem emulator =
****************************************************************************/
u32 systemGetClock( void )
{
mftb(&now);
return tb_diff_msec(&now, &start) - loadtimeradjust;
u32 now = gettime();
return diff_usec(start, now) / 1000;
}
void systemFrame() {}
@ -784,7 +780,7 @@ static void gbApplyPerImagePreferences()
else if (strcmp(title, "TMNT3") == 0)
RomIdCode = TMNT3;
}
// look for matching palettes if a monochrome gameboy game
// look for matching palettes if a monochrome gameboy game
// (or if a Super Gameboy game, but the palette will be ignored later in that case)
int snum = -1;
if ((Colour != 0x80) && (Colour != 0xC0)) {
@ -1095,7 +1091,7 @@ bool LoadVBAROM(int method)
lastTime = systemFrameSkip = 0;
// Start system clock
mftb(&start);
start = gettime();
return true;
}

View File

@ -14,7 +14,6 @@
#include "System.h"
extern struct EmulatedSystem emulator;
extern u32 loadtimeradjust;
extern int cartridgeType;
extern int SunBars;
extern u32 RomIdCode;

View File

@ -27,10 +27,6 @@
#include "filebrowser.h"
#include "gcunzip.h"
extern "C" {
#include "tbtime.h"
}
#define MEM_BAD 0xff
#define MEM_VM 0x01
#define MEM_UN 0x80
@ -40,7 +36,6 @@ unsigned int MEM2Storage = 0x91000000;
int GBAROMSize = 0;
#ifdef USE_VM
//extern u32 loadtimeradjust;
/** Setup VM to use small 16kb windows **/
#define VMSHIFTBITS 14
@ -362,11 +357,8 @@ int VMCPULoadROM(int method)
static void VMNewPage( int pageid )
{
int res;
//tb_t start,end;
char msg[512];
//mftb(&start);
res = fseek( romfile, pageid << VMSHIFTBITS, SEEK_SET );
if (res) // fseek returns non-zero on a failure
{
@ -379,20 +371,6 @@ static void VMNewPage( int pageid )
VMAllocate( pageid );
res = fread( vmpage[pageid].pageptr, 1, 1 << VMSHIFTBITS, romfile );
if ( res != ( 1 << VMSHIFTBITS ) )
{
// Homebrew ROMS may not have the expected amount of data
// and then end up here - but they still work - so we won't throw an error
/*sprintf(msg, "Error reading! %d bytes only\n", res);
InfoPrompt(msg);
VMClose();
ExitApp();*/
}
//mftb(&end);
//loadtimeradjust += tb_diff_msec(&end, &start);
}
/****************************************************************************