[Glide64] replace wxDateTime with CDateTime

This commit is contained in:
zilmar 2016-02-24 18:07:50 +11:00
parent 8d6e71fa0a
commit b59abd05fb
3 changed files with 226 additions and 231 deletions

View File

@ -70,6 +70,7 @@ the plugin
#include <stddef.h> // offsetof
#include <glide.h>
#include <Common/MemTest.h>
#include <Common/DateTimeClass.h>
#include <Settings/Settings.h>
#include "GlideExtensions.h"
#include "rdp.h"
@ -86,11 +87,6 @@ typedef unsigned char boolean;
#define GLIDE64_CATCH catch (...)
#endif
#ifndef TEXTURE_FILTER
typedef wxInt64 int64;
typedef wxUint64 uint64;
#endif
#if defined(__cplusplus)
extern "C" {
#endif
@ -154,9 +150,9 @@ extern "C" {
#define COLORED_DEBUGGER // ;) pretty colors
#ifdef FPS
extern wxDateTime fps_last;
extern wxDateTime fps_next;
extern float fps;
extern CDateTime fps_last;
extern CDateTime fps_next;
extern float fps;
extern uint32_t fps_count;
#endif
@ -216,10 +212,10 @@ extern "C" {
char Name[100]; /* Name of the DLL */
/* If DLL supports memory these memory options then set them to TRUE or FALSE
if it does not support it */
if it does not support it */
int NormalMemory; /* a normal uint8_t array */
int MemoryBswaped; /* a normal uint8_t array where the memory has been pre
bswap on a dword (32 bits) boundry */
bswap on a dword (32 bits) boundry */
} PLUGIN_INFO;
typedef struct
@ -316,193 +312,193 @@ extern "C" {
void WriteSettings(bool saveEmulationSettings = false);
/******************************************************************
Function: CaptureScreen
Purpose: This function dumps the current frame to a file
input: pointer to the directory to save the file to
output: none
*******************************************************************/
Function: CaptureScreen
Purpose: This function dumps the current frame to a file
input: pointer to the directory to save the file to
output: none
*******************************************************************/
EXPORT void CALL CaptureScreen(char * Directory);
/******************************************************************
Function: ChangeWindow
Purpose: to change the window between fullscreen and window
mode. If the window was in fullscreen this should
change the screen to window mode and vice vesa.
input: none
output: none
*******************************************************************/
Function: ChangeWindow
Purpose: to change the window between fullscreen and window
mode. If the window was in fullscreen this should
change the screen to window mode and vice vesa.
input: none
output: none
*******************************************************************/
EXPORT void CALL ChangeWindow(void);
/******************************************************************
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise.
input: none
output: none
*******************************************************************/
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise.
input: none
output: none
*******************************************************************/
EXPORT void CALL CloseDLL(void);
/******************************************************************
Function: DllAbout
Purpose: This function is optional function that is provided
to give further information about the DLL.
input: a handle to the window that calls this function
output: none
*******************************************************************/
Function: DllAbout
Purpose: This function is optional function that is provided
to give further information about the DLL.
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllAbout(HWND hParent);
/******************************************************************
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllConfig(HWND hParent);
/******************************************************************
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the dll
input: a handle to the window that calls this function
output: none
*******************************************************************/
EXPORT void CALL DllTest(HWND hParent);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
/******************************************************************
Function: DrawScreen
Purpose: This function is called when the emulator receives a
WM_PAINT message. This allows the gfx to fit in when
it is being used in the desktop.
input: none
output: none
*******************************************************************/
Function: DrawScreen
Purpose: This function is called when the emulator receives a
WM_PAINT message. This allows the gfx to fit in when
it is being used in the desktop.
input: none
output: none
*******************************************************************/
EXPORT void CALL DrawScreen(void);
/******************************************************************
Function: GetDllInfo
Purpose: This function allows the emulator to gather information
about the dll by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO stucture that needs to be
filled by the function. (see def above)
output: none
*******************************************************************/
Function: GetDllInfo
Purpose: This function allows the emulator to gather information
about the dll by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO stucture that needs to be
filled by the function. (see def above)
output: none
*******************************************************************/
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/******************************************************************
Function: InitiateGFX
Purpose: This function is called when the DLL is started to give
information from the emulator that the n64 graphics
uses. This is not called from the emulation thread.
Input: Gfx_Info is passed to this function which is defined
above.
Output: TRUE on success
FALSE on failure to initialise
Function: InitiateGFX
Purpose: This function is called when the DLL is started to give
information from the emulator that the n64 graphics
uses. This is not called from the emulation thread.
Input: Gfx_Info is passed to this function which is defined
above.
Output: TRUE on success
FALSE on failure to initialise
** note on interrupts **:
To generate an interrupt set the appropriate bit in MI_INTR_REG
and then call the function CheckInterrupts to tell the emulator
that there is a waiting interrupt.
*******************************************************************/
** note on interrupts **:
To generate an interrupt set the appropriate bit in MI_INTR_REG
and then call the function CheckInterrupts to tell the emulator
that there is a waiting interrupt.
*******************************************************************/
EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info);
/******************************************************************
Function: MoveScreen
Purpose: This function is called in response to the emulator
receiving a WM_MOVE passing the xpos and ypos passed
from that message.
input: xpos - the x-coordinate of the upper-left corner of the
client area of the window.
ypos - y-coordinate of the upper-left corner of the
client area of the window.
output: none
*******************************************************************/
Function: MoveScreen
Purpose: This function is called in response to the emulator
receiving a WM_MOVE passing the xpos and ypos passed
from that message.
input: xpos - the x-coordinate of the upper-left corner of the
client area of the window.
ypos - y-coordinate of the upper-left corner of the
client area of the window.
output: none
*******************************************************************/
EXPORT void CALL MoveScreen(int xpos, int ypos);
/******************************************************************
Function: ProcessDList
Purpose: This function is called when there is a Dlist to be
processed. (High level GFX list)
input: none
output: none
*******************************************************************/
Function: ProcessDList
Purpose: This function is called when there is a Dlist to be
processed. (High level GFX list)
input: none
output: none
*******************************************************************/
EXPORT void CALL ProcessDList(void);
/******************************************************************
Function: ProcessRDPList
Purpose: This function is called when there is a Dlist to be
processed. (Low level GFX list)
input: none
output: none
*******************************************************************/
Function: ProcessRDPList
Purpose: This function is called when there is a Dlist to be
processed. (Low level GFX list)
input: none
output: none
*******************************************************************/
EXPORT void CALL ProcessRDPList(void);
/******************************************************************
Function: RomClosed
Purpose: This function is called when a rom is closed.
input: none
output: none
*******************************************************************/
Function: RomClosed
Purpose: This function is called when a rom is closed.
input: none
output: none
*******************************************************************/
EXPORT void CALL RomClosed(void);
/******************************************************************
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
emulation thread)
input: none
output: none
*******************************************************************/
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
emulation thread)
input: none
output: none
*******************************************************************/
EXPORT void CALL RomOpen(void);
/******************************************************************
Function: ShowCFB
Purpose: Useally once Dlists are started being displayed, cfb is
ignored. This function tells the dll to start displaying
them again.
input: none
output: none
*******************************************************************/
Function: ShowCFB
Purpose: Useally once Dlists are started being displayed, cfb is
ignored. This function tells the dll to start displaying
them again.
input: none
output: none
*******************************************************************/
EXPORT void CALL ShowCFB(void);
/******************************************************************
Function: UpdateScreen
Purpose: This function is called in response to a vsync of the
screen were the VI bit in MI_INTR_REG has already been
set
input: none
output: none
*******************************************************************/
Function: UpdateScreen
Purpose: This function is called in response to a vsync of the
screen were the VI bit in MI_INTR_REG has already been
set
input: none
output: none
*******************************************************************/
EXPORT void CALL UpdateScreen(void);
/******************************************************************
Function: ViStatusChanged
Purpose: This function is called to notify the dll that the
ViStatus registers value has been changed.
input: none
output: none
*******************************************************************/
Function: ViStatusChanged
Purpose: This function is called to notify the dll that the
ViStatus registers value has been changed.
input: none
output: none
*******************************************************************/
EXPORT void CALL ViStatusChanged(void);
/******************************************************************
Function: ViWidthChanged
Purpose: This function is called to notify the dll that the
ViWidth registers value has been changed.
input: none
output: none
*******************************************************************/
Function: ViWidthChanged
Purpose: This function is called to notify the dll that the
ViWidth registers value has been changed.
input: none
output: none
*******************************************************************/
EXPORT void CALL ViWidthChanged(void);
/******************************************************************
Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: addr rdram address
val val
size 1 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: addr rdram address
val val
size 1 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBWrite(uint32_t, uint32_t);
typedef struct
@ -513,30 +509,30 @@ extern "C" {
} FrameBufferModifyEntry;
/******************************************************************
Function: FrameBufferWriteList
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: FrameBufferModifyEntry *plist
size = size of the plist, max = 1024
output: none
*******************************************************************/
Function: FrameBufferWriteList
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: FrameBufferModifyEntry *plist
size = size of the plist, max = 1024
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, uint32_t size);
/******************************************************************
Function: FrameBufferRead
Purpose: This function is called to notify the dll that the
frame buffer memory is beening read at the given address.
DLL should copy content from its render buffer to the frame buffer
in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
Function: FrameBufferRead
Purpose: This function is called to notify the dll that the
frame buffer memory is beening read at the given address.
DLL should copy content from its render buffer to the frame buffer
in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBRead(uint32_t addr);
/************************************************************************

View File

@ -96,8 +96,8 @@ int64 perf_next;
#endif
#ifdef FPS
wxDateTime fps_last;
wxDateTime fps_next;
CDateTime fps_last;
CDateTime fps_next;
float fps = 0.0f;
uint32_t fps_count = 0;
@ -153,8 +153,8 @@ CSettings * g_settings;
HOTKEY_INFO hotkey_info;
VOODOO voodoo = { 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
0, 0, 0, 0,
0, 0, 0, 0
};
GrTexInfo fontTex;
@ -704,8 +704,8 @@ void guLoadTextures()
if (cur&b) *tex8 = 0xFF;
else *tex8 = 0x00;
tex8++;
}
}
}
grTexDownloadMipMap(GR_TMU0,
voodoo.tex_min_addr[GR_TMU0] + offset_font,
@ -1371,7 +1371,7 @@ void CALL CloseDLL(void)
voodoo.gamma_table_g = 0;
delete[] voodoo.gamma_table_b;
voodoo.gamma_table_b = 0;
}
}
/******************************************************************
Function: DllTest
@ -1454,7 +1454,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
g_settings->res_data_org = g_settings->res_data;
#ifdef FPS
fps_last = wxDateTime::UNow();
fps_last.SetToNow();
#endif
debug_init(); // Initialize debugger
@ -1641,14 +1641,14 @@ static void CheckDRAMSize()
{
test = gfx.RDRAM[0x007FFFFF] + 1;
}
GLIDE64_CATCH
GLIDE64_CATCH
{
test = 0;
}
if (test)
BMASK = 0x7FFFFF;
else
BMASK = WMASK;
if (test)
BMASK = 0x7FFFFF;
else
BMASK = WMASK;
#ifdef LOGGING
sprintf(out_buf, "Detected RDRAM size: %08lx", BMASK);
LOG(out_buf);
@ -1824,9 +1824,8 @@ void CALL UpdateScreen(void)
vi_count++;
// Check frames per second
fps_next = wxDateTime::UNow();
wxTimeSpan difference = fps_next - fps_last;
double diff_secs = difference.GetMilliseconds().ToDouble() / 1000.0;
fps_next.SetToNow();
double diff_secs = fps_next.DiffernceMilliseconds(fps_last);
if (diff_secs > 0.5f)
{
fps = (float)(fps_count / diff_secs);
@ -1952,11 +1951,11 @@ void newSwapBuffers()
{
if (g_settings->clock_24_hr)
{
output(956.0f, 0, 1, (char*)wxDateTime::Now().Format("%H:%M:%S").char_str(), 0);
output(956.0f, 0, 1, CDateTime().SetToNow().Format("%H:%M:%S").c_str(), 0);
}
else
{
output(930.0f, 0, 1, (char*)wxDateTime::Now().Format("%I:%M:%S %p").char_str(), 0);
output(930.0f, 0, 1, CDateTime().SetToNow().Format("%I:%M:%S %p").c_str(), 0);
}
}
//hotkeys
@ -2340,7 +2339,7 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
if (p->vkCode == 46) k_del = 1;
goto do_it;
do_it:
do_it:
TabKey =
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||
((p->vkCode == VK_ESCAPE) && ((p->flags & LLKHF_ALTDOWN) != 0)) ||

View File

@ -67,55 +67,55 @@ SCREEN_SHOT_FORMAT ScreenShotFormats[NumOfFormats] =
const char *ACmp[] = { "NONE", "THRESHOLD", "UNKNOWN", "DITHER" };
const char *Mode0[] = { "COMBINED", "TEXEL0",
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"1", "NOISE",
"0", "0",
"0", "0",
"0", "0",
"0", "0" };
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"1", "NOISE",
"0", "0",
"0", "0",
"0", "0",
"0", "0" };
const char *Mode1[] = { "COMBINED", "TEXEL0",
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"CENTER", "K4",
"0", "0",
"0", "0",
"0", "0",
"0", "0" };
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"CENTER", "K4",
"0", "0",
"0", "0",
"0", "0",
"0", "0" };
const char *Mode2[] = { "COMBINED", "TEXEL0",
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"SCALE", "COMBINED_ALPHA",
"T0_ALPHA", "T1_ALPHA",
"PRIM_ALPHA", "SHADE_ALPHA",
"ENV_ALPHA", "LOD_FRACTION",
"PRIM_LODFRAC", "K5",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0" };
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"SCALE", "COMBINED_ALPHA",
"T0_ALPHA", "T1_ALPHA",
"PRIM_ALPHA", "SHADE_ALPHA",
"ENV_ALPHA", "LOD_FRACTION",
"PRIM_LODFRAC", "K5",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0",
"0", "0" };
const char *Mode3[] = { "COMBINED", "TEXEL0",
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"1", "0" };
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"1", "0" };
const char *Alpha0[] = { "COMBINED", "TEXEL0",
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"1", "0" };
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"1", "0" };
#define Alpha1 Alpha0
const char *Alpha2[] = { "LOD_FRACTION", "TEXEL0",
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"PRIM_LODFRAC", "0" };
"TEXEL1", "PRIMITIVE",
"SHADE", "ENVIORNMENT",
"PRIM_LODFRAC", "0" };
#define Alpha3 Alpha0
const char *FBLa[] = { "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" };
@ -144,8 +144,8 @@ const char *str_tlut[] = { "TT_NONE", "TT_UNKNOWN", "TT_RGBA_16", "TT_IA_16" };
const char *str_dither[] = { "Pattern", "~Pattern", "Noise", "None" };
const char *CIStatus[] = { "ci_main", "ci_zimg", "ci_unknown", "ci_useless",
"ci_old_copy", "ci_copy", "ci_copy_self",
"ci_zcopy", "ci_aux", "ci_aux_copy" };
"ci_old_copy", "ci_copy", "ci_copy_self",
"ci_zcopy", "ci_aux", "ci_aux_copy" };
//static variables
@ -394,10 +394,10 @@ static void DrawPartFrameBufferToScreen()
}
#define RGBA16TO32(color) \
((color&1)?0xFF:0) | \
((uint32_t)((float)((color&0xF800) >> 11) / 31.0f * 255.0f) << 24) | \
((uint32_t)((float)((color&0x07C0) >> 6) / 31.0f * 255.0f) << 16) | \
((uint32_t)((float)((color&0x003E) >> 1) / 31.0f * 255.0f) << 8)
((color&1)?0xFF:0) | \
((uint32_t)((float)((color&0xF800) >> 11) / 31.0f * 255.0f) << 24) | \
((uint32_t)((float)((color&0x07C0) >> 6) / 31.0f * 255.0f) << 16) | \
((uint32_t)((float)((color&0x003E) >> 1) / 31.0f * 255.0f) << 8)
static void copyWhiteToRDRAM()
{
@ -729,7 +729,7 @@ EXPORT void CALL ProcessDList(void)
rdp.pc[rdp.pc_i] = (a + 8) & BMASK;
#ifdef PERFORMANCE
perf_cur = wxDateTime::UNow();
perf_cur = CDateTime().SetToNow().Value();
#endif
// Process this instruction
gfx_instruction[g_settings->ucode][rdp.cmd0 >> 24]();
@ -748,7 +748,7 @@ EXPORT void CALL ProcessDList(void)
}
#ifdef PERFORMANCE
perf_next = wxDateTime::UNow();
perf_next = CDateTime().SetToNow().Value();
sprintf(out_buf, "perf %08lx: %016I64d", a - 8, (perf_next - perf_cur).Format(_T("%l")).mb_str());
rdp_log << out_buf;
#endif
@ -1557,14 +1557,14 @@ static void rdp_setprimdepth()
static void rdp_setothermode()
{
#define F3DEX2_SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \
rdp.cmd1 = (uint32_t)(data); \
gfx_instruction[g_settings->ucode][cmd] (); \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \
rdp.cmd1 = (uint32_t)(data); \
gfx_instruction[g_settings->ucode][cmd] (); \
}
#define SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((sft)<<8) | (len)); \
rdp.cmd1 = (uint32_t)data; \
gfx_instruction[g_settings->ucode][cmd] (); \
rdp.cmd0 = (uint32_t)((cmd<<24) | ((sft)<<8) | (len)); \
rdp.cmd1 = (uint32_t)data; \
gfx_instruction[g_settings->ucode][cmd] (); \
}
WriteTrace(TraceRDP, TraceDebug, "rdp_setothermode");