mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 04:24:16 +01:00
remove tmbinc msec timer, replace with libogc usec timer. fix unfiltered mode.
This commit is contained in:
parent
2838765896
commit
6ed7f2e8ee
@ -17,9 +17,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
extern "C" {
|
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "vba.h"
|
#include "vba.h"
|
||||||
|
@ -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)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -17,9 +17,7 @@
|
|||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
extern "C" {
|
|
||||||
#include <di/di.h>
|
#include <di/di.h>
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "FreeTypeGX.h"
|
#include "FreeTypeGX.h"
|
||||||
|
@ -34,7 +34,7 @@ void FixInvalidSettings()
|
|||||||
GCSettings.MusicVolume = 40;
|
GCSettings.MusicVolume = 40;
|
||||||
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
|
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
|
||||||
GCSettings.SFXVolume = 40;
|
GCSettings.SFXVolume = 40;
|
||||||
if(!(GCSettings.render >= 0 && GCSettings.render < 2))
|
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
|
||||||
GCSettings.render = 1;
|
GCSettings.render = 1;
|
||||||
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
|
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
|
||||||
GCSettings.videomode = 0;
|
GCSettings.videomode = 0;
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
long long gettime();
|
||||||
|
u32 diff_usec(long long start,long long end);
|
||||||
|
}
|
||||||
|
|
||||||
#include "pngu/pngu.h"
|
#include "pngu/pngu.h"
|
||||||
|
|
||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
@ -46,16 +51,7 @@
|
|||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
#include "gamesettings.h"
|
#include "gamesettings.h"
|
||||||
|
|
||||||
extern "C"
|
static u32 start;
|
||||||
{
|
|
||||||
#include "tbtime.h"
|
|
||||||
long long gettime();
|
|
||||||
u32 diff_usec(long long start,long long end);
|
|
||||||
}
|
|
||||||
|
|
||||||
static tb_t start, now;
|
|
||||||
|
|
||||||
u32 loadtimeradjust;
|
|
||||||
int cartridgeType = 0;
|
int cartridgeType = 0;
|
||||||
u32 RomIdCode;
|
u32 RomIdCode;
|
||||||
int SunBars = 3;
|
int SunBars = 3;
|
||||||
@ -114,8 +110,8 @@ struct EmulatedSystem emulator =
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
u32 systemGetClock( void )
|
u32 systemGetClock( void )
|
||||||
{
|
{
|
||||||
mftb(&now);
|
u32 now = gettime();
|
||||||
return tb_diff_msec(&now, &start) - loadtimeradjust;
|
return diff_usec(start, now) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void systemFrame() {}
|
void systemFrame() {}
|
||||||
@ -1095,7 +1091,7 @@ bool LoadVBAROM(int method)
|
|||||||
lastTime = systemFrameSkip = 0;
|
lastTime = systemFrameSkip = 0;
|
||||||
|
|
||||||
// Start system clock
|
// Start system clock
|
||||||
mftb(&start);
|
start = gettime();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
extern struct EmulatedSystem emulator;
|
extern struct EmulatedSystem emulator;
|
||||||
extern u32 loadtimeradjust;
|
|
||||||
extern int cartridgeType;
|
extern int cartridgeType;
|
||||||
extern int SunBars;
|
extern int SunBars;
|
||||||
extern u32 RomIdCode;
|
extern u32 RomIdCode;
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
#include "filebrowser.h"
|
#include "filebrowser.h"
|
||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "tbtime.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MEM_BAD 0xff
|
#define MEM_BAD 0xff
|
||||||
#define MEM_VM 0x01
|
#define MEM_VM 0x01
|
||||||
#define MEM_UN 0x80
|
#define MEM_UN 0x80
|
||||||
@ -40,7 +36,6 @@ unsigned int MEM2Storage = 0x91000000;
|
|||||||
int GBAROMSize = 0;
|
int GBAROMSize = 0;
|
||||||
|
|
||||||
#ifdef USE_VM
|
#ifdef USE_VM
|
||||||
//extern u32 loadtimeradjust;
|
|
||||||
|
|
||||||
/** Setup VM to use small 16kb windows **/
|
/** Setup VM to use small 16kb windows **/
|
||||||
#define VMSHIFTBITS 14
|
#define VMSHIFTBITS 14
|
||||||
@ -362,11 +357,8 @@ int VMCPULoadROM(int method)
|
|||||||
static void VMNewPage( int pageid )
|
static void VMNewPage( int pageid )
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
//tb_t start,end;
|
|
||||||
char msg[512];
|
char msg[512];
|
||||||
|
|
||||||
//mftb(&start);
|
|
||||||
|
|
||||||
res = fseek( romfile, pageid << VMSHIFTBITS, SEEK_SET );
|
res = fseek( romfile, pageid << VMSHIFTBITS, SEEK_SET );
|
||||||
if (res) // fseek returns non-zero on a failure
|
if (res) // fseek returns non-zero on a failure
|
||||||
{
|
{
|
||||||
@ -379,20 +371,6 @@ static void VMNewPage( int pageid )
|
|||||||
VMAllocate( pageid );
|
VMAllocate( pageid );
|
||||||
|
|
||||||
res = fread( vmpage[pageid].pageptr, 1, 1 << VMSHIFTBITS, romfile );
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user