reorganize hud drawing and move it to the core
This commit is contained in:
parent
6cd699f684
commit
1e28d6aebe
|
@ -32,8 +32,179 @@
|
||||||
#include "aggdraw.h"
|
#include "aggdraw.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
#include "NDSSystem.h"
|
#include "NDSSystem.h"
|
||||||
|
#include "mic.h"
|
||||||
|
|
||||||
OSDCLASS *osd = NULL;
|
OSDCLASS *osd = NULL;
|
||||||
|
HudStruct Hud;
|
||||||
|
|
||||||
|
void SetHudDummy (HudCoordinates *hud)
|
||||||
|
{
|
||||||
|
hud->x=666;
|
||||||
|
hud->y=666;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsHudDummy (HudCoordinates *hud)
|
||||||
|
{
|
||||||
|
return (hud->x == 666 && hud->y == 666);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditHud(s32 x, s32 y, HudStruct *hudstruct) {
|
||||||
|
|
||||||
|
UINT i = 0;
|
||||||
|
|
||||||
|
while (!IsHudDummy(&hudstruct->hud(i))) {
|
||||||
|
HudCoordinates &hud = hudstruct->hud(i);
|
||||||
|
|
||||||
|
//reset
|
||||||
|
if(!hud.clicked) {
|
||||||
|
hud.storedx=0;
|
||||||
|
hud.storedy=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((x >= hud.x && x <= hud.x + hud.xsize) &&
|
||||||
|
(y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) {
|
||||||
|
|
||||||
|
hud.clicked=1;
|
||||||
|
hud.storedx = x - hud.x;
|
||||||
|
hud.storedy = y - hud.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hud.clicked) {
|
||||||
|
hud.x = x - hud.storedx;
|
||||||
|
hud.y = y - hud.storedy;
|
||||||
|
}
|
||||||
|
|
||||||
|
//sanity checks
|
||||||
|
if(hud.x < 0) hud.x = 0;
|
||||||
|
if(hud.y < 0) hud.y = 0;
|
||||||
|
if(hud.x > 245)hud.x = 245; //margins
|
||||||
|
if(hud.y > 180)hud.y = 180;
|
||||||
|
|
||||||
|
if(hud.clicked)
|
||||||
|
break;//prevent items from grouping together
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HudClickRelease(HudStruct *hudstruct) {
|
||||||
|
|
||||||
|
UINT i = 0;
|
||||||
|
|
||||||
|
while (!IsHudDummy(&hudstruct->hud(i))) {
|
||||||
|
HudCoordinates &hud = hudstruct->hud(i);
|
||||||
|
hud.clicked=0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetHud(HudStruct *hudstruct) {
|
||||||
|
|
||||||
|
hudstruct->FpsDisplay.x=0;
|
||||||
|
hudstruct->FpsDisplay.y=5;
|
||||||
|
hudstruct->FpsDisplay.xsize=120;
|
||||||
|
hudstruct->FpsDisplay.ysize=10;
|
||||||
|
|
||||||
|
hudstruct->FrameCounter.x=0;
|
||||||
|
hudstruct->FrameCounter.y=25;
|
||||||
|
hudstruct->FrameCounter.xsize=60;
|
||||||
|
hudstruct->FrameCounter.ysize=10;
|
||||||
|
|
||||||
|
hudstruct->InputDisplay.x=0;
|
||||||
|
hudstruct->InputDisplay.y=45;
|
||||||
|
hudstruct->InputDisplay.xsize=120;
|
||||||
|
hudstruct->InputDisplay.ysize=10;
|
||||||
|
|
||||||
|
hudstruct->LagFrameCounter.x=0;
|
||||||
|
hudstruct->LagFrameCounter.y=65;
|
||||||
|
hudstruct->LagFrameCounter.xsize=30;
|
||||||
|
hudstruct->LagFrameCounter.ysize=10;
|
||||||
|
|
||||||
|
hudstruct->Microphone.x=0;
|
||||||
|
hudstruct->Microphone.y=85;
|
||||||
|
hudstruct->Microphone.xsize=20;
|
||||||
|
hudstruct->Microphone.ysize=10;
|
||||||
|
|
||||||
|
SetHudDummy(&hudstruct->Dummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct TouchInfo{
|
||||||
|
u16 X;
|
||||||
|
u16 Y;
|
||||||
|
};
|
||||||
|
static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255};
|
||||||
|
static TouchInfo temptouch;
|
||||||
|
bool touchshadow = true;
|
||||||
|
static std::vector<TouchInfo> touch (8);
|
||||||
|
|
||||||
|
|
||||||
|
static void TouchDisplay() {
|
||||||
|
aggDraw.hud->lineWidth(1.0);
|
||||||
|
|
||||||
|
temptouch.X = nds.touchX >> 4;
|
||||||
|
temptouch.Y = nds.touchY >> 4;
|
||||||
|
touch.push_back(temptouch);
|
||||||
|
|
||||||
|
if(touch.size() > 8) touch.erase(touch.begin());
|
||||||
|
|
||||||
|
if(touchshadow) {
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
temptouch = touch[i];
|
||||||
|
if(temptouch.X != 0 || temptouch.Y != 0) {
|
||||||
|
aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]);
|
||||||
|
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
|
||||||
|
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
|
||||||
|
aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]);
|
||||||
|
aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(nds.isTouch) {
|
||||||
|
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
|
||||||
|
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void DrawHUD()
|
||||||
|
{
|
||||||
|
if (CommonSettings.hud.ShowInputDisplay)
|
||||||
|
{
|
||||||
|
osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",InputDisplayString.c_str());
|
||||||
|
TouchDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonSettings.hud.FpsDisplay)
|
||||||
|
{
|
||||||
|
osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", Hud.fps, Hud.fps3d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonSettings.hud.FrameCounterDisplay)
|
||||||
|
{
|
||||||
|
if (movieMode == MOVIEMODE_PLAY)
|
||||||
|
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size());
|
||||||
|
else if(movieMode == MOVIEMODE_RECORD)
|
||||||
|
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter);
|
||||||
|
else
|
||||||
|
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonSettings.hud.ShowLagFrameCounter)
|
||||||
|
{
|
||||||
|
osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonSettings.hud.ShowMicrophone)
|
||||||
|
{
|
||||||
|
osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OSDCLASS::OSDCLASS(u8 core)
|
OSDCLASS::OSDCLASS(u8 core)
|
||||||
{
|
{
|
||||||
|
@ -208,45 +379,3 @@ void OSDCLASS::border(bool enabled)
|
||||||
{
|
{
|
||||||
//render51.setTextBoxBorder(enabled);
|
//render51.setTextBoxBorder(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TouchInfo{
|
|
||||||
u16 X;
|
|
||||||
u16 Y;
|
|
||||||
};
|
|
||||||
static int touchalpha[8]= {31, 63, 95, 127, 159, 191, 223, 255};
|
|
||||||
static TouchInfo temptouch;
|
|
||||||
bool touchshadow = true;
|
|
||||||
static std::vector<TouchInfo> touch (8);
|
|
||||||
|
|
||||||
void OSDCLASS::TouchDisplay(){
|
|
||||||
|
|
||||||
if(!ShowInputDisplay) return;
|
|
||||||
|
|
||||||
aggDraw.hud->lineWidth(1.0);
|
|
||||||
|
|
||||||
temptouch.X = nds.touchX >> 4;
|
|
||||||
temptouch.Y = nds.touchY >> 4;
|
|
||||||
touch.push_back(temptouch);
|
|
||||||
|
|
||||||
if(touch.size() > 8) touch.erase(touch.begin());
|
|
||||||
|
|
||||||
if(touchshadow) {
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
temptouch = touch[i];
|
|
||||||
if(temptouch.X != 0 || temptouch.Y != 0) {
|
|
||||||
aggDraw.hud->lineColor(0, 255, 0, touchalpha[i]);
|
|
||||||
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
|
|
||||||
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
|
|
||||||
aggDraw.hud->fillColor(0, 0, 0, touchalpha[i]);
|
|
||||||
aggDraw.hud->rectangle(temptouch.X-1, temptouch.Y-1 + 192, temptouch.X+1, temptouch.Y+1 + 192);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(nds.isTouch) {
|
|
||||||
aggDraw.hud->line(temptouch.X - 256, temptouch.Y + 192, temptouch.X + 256, temptouch.Y + 192); //horiz
|
|
||||||
aggDraw.hud->line(temptouch.X, temptouch.Y - 256, temptouch.X, temptouch.Y + 384); //vert
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,45 @@
|
||||||
#define OSD_MAX_LINES 4
|
#define OSD_MAX_LINES 4
|
||||||
#define OSD_TIMER_SECS 2
|
#define OSD_TIMER_SECS 2
|
||||||
|
|
||||||
|
|
||||||
|
struct HudCoordinates{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int xsize;
|
||||||
|
int ysize;
|
||||||
|
int storedx;
|
||||||
|
int storedy;
|
||||||
|
int clicked;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct HudStruct
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HudStruct()
|
||||||
|
: fps(0)
|
||||||
|
, fps3d(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
HudCoordinates FpsDisplay;
|
||||||
|
HudCoordinates FrameCounter;
|
||||||
|
HudCoordinates InputDisplay;
|
||||||
|
HudCoordinates LagFrameCounter;
|
||||||
|
HudCoordinates Microphone;
|
||||||
|
HudCoordinates Dummy;
|
||||||
|
|
||||||
|
HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; }
|
||||||
|
|
||||||
|
int fps, fps3d;
|
||||||
|
};
|
||||||
|
|
||||||
|
void ResetHud(HudStruct *hudstruct);
|
||||||
|
void EditHud(s32 x, s32 y, HudStruct *hudstruct);
|
||||||
|
void HudClickRelease(HudStruct *hudstruct);
|
||||||
|
|
||||||
|
void DrawHUD();
|
||||||
|
|
||||||
|
extern HudStruct Hud;
|
||||||
|
|
||||||
class OSDCLASS
|
class OSDCLASS
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -66,7 +105,6 @@ public:
|
||||||
void addLine(const char *fmt, ...);
|
void addLine(const char *fmt, ...);
|
||||||
void addFixed(u16 x, u16 y, const char *fmt, ...);
|
void addFixed(u16 x, u16 y, const char *fmt, ...);
|
||||||
void border(bool enabled);
|
void border(bool enabled);
|
||||||
void TouchDisplay();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern OSDCLASS *osd;
|
extern OSDCLASS *osd;
|
||||||
|
|
|
@ -308,55 +308,57 @@ template<bool FORCE> void NDS_exec(s32 nb = 560190<<1);
|
||||||
|
|
||||||
extern int lagframecounter;
|
extern int lagframecounter;
|
||||||
|
|
||||||
static INLINE void NDS_ARM9HBlankInt(void)
|
static INLINE void NDS_ARM9HBlankInt(void)
|
||||||
{
|
{
|
||||||
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x10)
|
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x10)
|
||||||
{
|
{
|
||||||
//MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1));
|
//MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1));
|
||||||
setIF(0, 2);
|
setIF(0, 2);
|
||||||
NDS_ARM9.wIRQ = TRUE;
|
NDS_ARM9.wIRQ = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void NDS_ARM7HBlankInt(void)
|
static INLINE void NDS_ARM7HBlankInt(void)
|
||||||
{
|
{
|
||||||
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
|
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
|
||||||
{
|
{
|
||||||
// MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
|
// MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
|
||||||
setIF(1, 2);
|
setIF(1, 2);
|
||||||
NDS_ARM7.wIRQ = TRUE;
|
NDS_ARM7.wIRQ = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void NDS_ARM9VBlankInt(void)
|
static INLINE void NDS_ARM9VBlankInt(void)
|
||||||
{
|
{
|
||||||
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8)
|
if(T1ReadWord(ARM9Mem.ARM9_REG, 4) & 0x8)
|
||||||
{
|
{
|
||||||
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
|
// MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
|
||||||
setIF(0, 1);
|
setIF(0, 1);
|
||||||
NDS_ARM9.wIRQ = TRUE;
|
NDS_ARM9.wIRQ = TRUE;
|
||||||
//emu_halt();
|
//emu_halt();
|
||||||
/*logcount++;*/
|
/*logcount++;*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void NDS_ARM7VBlankInt(void)
|
static INLINE void NDS_ARM7VBlankInt(void)
|
||||||
{
|
{
|
||||||
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
|
if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
|
||||||
// MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
|
// MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
|
||||||
setIF(1, 1);
|
setIF(1, 1);
|
||||||
NDS_ARM7.wIRQ = TRUE;
|
NDS_ARM7.wIRQ = TRUE;
|
||||||
//emu_halt();
|
//emu_halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void NDS_swapScreen(void)
|
static INLINE void NDS_swapScreen(void)
|
||||||
{
|
{
|
||||||
u16 tmp = MainScreen.offset;
|
u16 tmp = MainScreen.offset;
|
||||||
MainScreen.offset = SubScreen.offset;
|
MainScreen.offset = SubScreen.offset;
|
||||||
SubScreen.offset = tmp;
|
SubScreen.offset = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
|
||||||
|
|
||||||
|
|
||||||
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
|
|
||||||
|
|
||||||
extern struct TCommonSettings {
|
extern struct TCommonSettings {
|
||||||
TCommonSettings()
|
TCommonSettings()
|
||||||
|
@ -412,6 +414,17 @@ extern struct TCommonSettings {
|
||||||
};
|
};
|
||||||
} showGpu;
|
} showGpu;
|
||||||
|
|
||||||
|
struct _Hud {
|
||||||
|
_Hud()
|
||||||
|
: ShowInputDisplay(false)
|
||||||
|
, FpsDisplay(false)
|
||||||
|
, FrameCounterDisplay(false)
|
||||||
|
, ShowLagFrameCounter(false)
|
||||||
|
, ShowMicrophone(false)
|
||||||
|
{}
|
||||||
|
bool ShowInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone;
|
||||||
|
} hud;
|
||||||
|
|
||||||
} CommonSettings;
|
} CommonSettings;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,18 @@ void GetINIPath()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file)
|
||||||
|
{
|
||||||
|
char temp[256] = "";
|
||||||
|
sprintf(temp, "%d", val?1:0);
|
||||||
|
WritePrivateProfileString(appname, keyname, temp, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename)
|
||||||
|
{
|
||||||
|
return GetPrivateProfileInt(appname,keyname,defval?1:0,filename) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file)
|
void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file)
|
||||||
{
|
{
|
||||||
char temp[256] = "";
|
char temp[256] = "";
|
||||||
|
|
|
@ -77,6 +77,9 @@ void SetRomName(const char *filename);
|
||||||
extern void GetINIPath();
|
extern void GetINIPath();
|
||||||
extern void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file);
|
extern void WritePrivateProfileInt(char* appname, char* keyname, int val, char* file);
|
||||||
|
|
||||||
|
bool GetPrivateProfileBool(const char* appname, const char* keyname, bool defval, const char* filename);
|
||||||
|
void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file);
|
||||||
|
|
||||||
#else // non Windows
|
#else // non Windows
|
||||||
|
|
||||||
#define sscanf_s sscanf
|
#define sscanf_s sscanf
|
||||||
|
|
|
@ -988,7 +988,7 @@ int gfx3d_GetNumVertex()
|
||||||
void gfx3d_glPolygonAttrib (u32 val)
|
void gfx3d_glPolygonAttrib (u32 val)
|
||||||
{
|
{
|
||||||
if(inBegin) {
|
if(inBegin) {
|
||||||
PROGINFO("Set polyattr in the middle of a begin/end pair.\n (This won't be activated until the next begin)\n");
|
//PROGINFO("Set polyattr in the middle of a begin/end pair.\n (This won't be activated until the next begin)\n");
|
||||||
//TODO - we need some some similar checking for teximageparam etc.
|
//TODO - we need some some similar checking for teximageparam etc.
|
||||||
}
|
}
|
||||||
polyAttrPending = val;
|
polyAttrPending = val;
|
||||||
|
|
|
@ -58,7 +58,6 @@ bool movie_readonly = true;
|
||||||
char curMovieFilename[512] = {0};
|
char curMovieFilename[512] = {0};
|
||||||
MovieData currMovieData;
|
MovieData currMovieData;
|
||||||
int currRerecordCount;
|
int currRerecordCount;
|
||||||
bool ShowInputDisplay = false;
|
|
||||||
bool movie_reset_command = false;
|
bool movie_reset_command = false;
|
||||||
bool movie_lid = false;
|
bool movie_lid = false;
|
||||||
//--------------
|
//--------------
|
||||||
|
@ -697,9 +696,6 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s
|
||||||
|
|
||||||
/*extern uint8 joy[4];
|
/*extern uint8 joy[4];
|
||||||
memcpy(&cur_input_display,joy,4);*/
|
memcpy(&cur_input_display,joy,4);*/
|
||||||
|
|
||||||
osd->TouchDisplay();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1498,7 +1498,9 @@ void WIFI_SoftAP_usTrigger(wifimac_t *wifi)
|
||||||
{
|
{
|
||||||
//if(wifi->ioMem[0xD0 >> 1] & 0x0400)
|
//if(wifi->ioMem[0xD0 >> 1] & 0x0400)
|
||||||
{
|
{
|
||||||
if((wifi->SoftAP.usecCounter % 100000) == 0)
|
//zero sez: every 1/10 second? does it have to be precise? this is so costly..
|
||||||
|
//if((wifi->SoftAP.usecCounter % 100000) == 0)
|
||||||
|
if((wifi->SoftAP.usecCounter & 131071) == 0)
|
||||||
{
|
{
|
||||||
WIFI_SoftAP_SendBeacon(wifi);
|
WIFI_SoftAP_SendBeacon(wifi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,10 +208,10 @@ void HK_Reset(int) {ResetGame();}
|
||||||
void HK_RecordAVI(int) { if (AVI_IsRecording()) AviEnd(); else AviRecordTo(); }
|
void HK_RecordAVI(int) { if (AVI_IsRecording()) AviEnd(); else AviRecordTo(); }
|
||||||
void HK_RecordWAV(int) { if (WAV_IsRecording()) WavEnd(); else WavRecordTo(); }
|
void HK_RecordWAV(int) { if (WAV_IsRecording()) WavEnd(); else WavRecordTo(); }
|
||||||
|
|
||||||
void HK_ToggleFrame(int) {frameCounterDisplay ^= true;}
|
void HK_ToggleFrame(int) {CommonSettings.hud.FrameCounterDisplay ^= true;}
|
||||||
void HK_ToggleFPS(int) {FpsDisplay ^= true;}
|
void HK_ToggleFPS(int) {CommonSettings.hud.FpsDisplay ^= true;}
|
||||||
void HK_ToggleInput(int) {ShowInputDisplay ^= true;}
|
void HK_ToggleInput(int) {CommonSettings.hud.ShowInputDisplay ^= true;}
|
||||||
void HK_ToggleLag(int) {ShowLagFrameCounter ^= true;}
|
void HK_ToggleLag(int) {CommonSettings.hud.ShowLagFrameCounter ^= true;}
|
||||||
void HK_ResetLagCounter(int) {
|
void HK_ResetLagCounter(int) {
|
||||||
lagframecounter=0;
|
lagframecounter=0;
|
||||||
LagFrameFlag=0;
|
LagFrameFlag=0;
|
||||||
|
|
|
@ -261,129 +261,11 @@ int autoframeskipenab=0;
|
||||||
int frameskiprate=0;
|
int frameskiprate=0;
|
||||||
int emu_paused = 0;
|
int emu_paused = 0;
|
||||||
bool frameAdvance = false;
|
bool frameAdvance = false;
|
||||||
bool frameCounterDisplay = false;
|
|
||||||
bool FpsDisplay = false;
|
|
||||||
bool ShowLagFrameCounter = false;
|
|
||||||
bool ShowMicrophone = false;
|
|
||||||
bool HudEditorMode = false;
|
bool HudEditorMode = false;
|
||||||
bool UseMicSample = false;
|
bool UseMicSample = false;
|
||||||
unsigned short windowSize = 0;
|
unsigned short windowSize = 0;
|
||||||
|
|
||||||
struct HudCoordinates{
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int xsize;
|
|
||||||
int ysize;
|
|
||||||
int storedx;
|
|
||||||
int storedy;
|
|
||||||
int clicked;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct HudStruct {
|
|
||||||
|
|
||||||
HudCoordinates FpsDisplay;
|
|
||||||
HudCoordinates FrameCounter;
|
|
||||||
HudCoordinates InputDisplay;
|
|
||||||
HudCoordinates LagFrameCounter;
|
|
||||||
HudCoordinates Microphone;
|
|
||||||
HudCoordinates Dummy;
|
|
||||||
|
|
||||||
HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; }
|
|
||||||
};
|
|
||||||
|
|
||||||
void SetHudDummy (HudCoordinates *hud)
|
|
||||||
{
|
|
||||||
hud->x=666;
|
|
||||||
hud->y=666;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsHudDummy (HudCoordinates *hud)
|
|
||||||
{
|
|
||||||
return (hud->x == 666 && hud->y == 666);
|
|
||||||
}
|
|
||||||
|
|
||||||
HudStruct Hud;
|
|
||||||
|
|
||||||
void EditHud(s32 x, s32 y, HudStruct *hudstruct) {
|
|
||||||
|
|
||||||
UINT i = 0;
|
|
||||||
|
|
||||||
while (!IsHudDummy(&hudstruct->hud(i))) {
|
|
||||||
HudCoordinates &hud = hudstruct->hud(i);
|
|
||||||
|
|
||||||
//reset
|
|
||||||
if(!hud.clicked) {
|
|
||||||
hud.storedx=0;
|
|
||||||
hud.storedy=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((x >= hud.x && x <= hud.x + hud.xsize) &&
|
|
||||||
(y >= hud.y && y <= hud.y + hud.ysize) && !hud.clicked ) {
|
|
||||||
|
|
||||||
hud.clicked=1;
|
|
||||||
hud.storedx = x - hud.x;
|
|
||||||
hud.storedy = y - hud.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hud.clicked) {
|
|
||||||
hud.x = x - hud.storedx;
|
|
||||||
hud.y = y - hud.storedy;
|
|
||||||
}
|
|
||||||
|
|
||||||
//sanity checks
|
|
||||||
if(hud.x < 0) hud.x = 0;
|
|
||||||
if(hud.y < 0) hud.y = 0;
|
|
||||||
if(hud.x > 245)hud.x = 245; //margins
|
|
||||||
if(hud.y > 180)hud.y = 180;
|
|
||||||
|
|
||||||
if(hud.clicked)
|
|
||||||
break;//prevent items from grouping together
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HudClickRelease(HudStruct *hudstruct) {
|
|
||||||
|
|
||||||
UINT i = 0;
|
|
||||||
|
|
||||||
while (!IsHudDummy(&hudstruct->hud(i))) {
|
|
||||||
HudCoordinates &hud = hudstruct->hud(i);
|
|
||||||
hud.clicked=0;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResetHud(HudStruct *hudstruct) {
|
|
||||||
|
|
||||||
hudstruct->FpsDisplay.x=0;
|
|
||||||
hudstruct->FpsDisplay.y=5;
|
|
||||||
hudstruct->FpsDisplay.xsize=120;
|
|
||||||
hudstruct->FpsDisplay.ysize=10;
|
|
||||||
|
|
||||||
hudstruct->FrameCounter.x=0;
|
|
||||||
hudstruct->FrameCounter.y=25;
|
|
||||||
hudstruct->FrameCounter.xsize=60;
|
|
||||||
hudstruct->FrameCounter.ysize=10;
|
|
||||||
|
|
||||||
hudstruct->InputDisplay.x=0;
|
|
||||||
hudstruct->InputDisplay.y=45;
|
|
||||||
hudstruct->InputDisplay.xsize=120;
|
|
||||||
hudstruct->InputDisplay.ysize=10;
|
|
||||||
|
|
||||||
hudstruct->LagFrameCounter.x=0;
|
|
||||||
hudstruct->LagFrameCounter.y=65;
|
|
||||||
hudstruct->LagFrameCounter.xsize=30;
|
|
||||||
hudstruct->LagFrameCounter.ysize=10;
|
|
||||||
|
|
||||||
hudstruct->Microphone.x=0;
|
|
||||||
hudstruct->Microphone.y=85;
|
|
||||||
hudstruct->Microphone.xsize=20;
|
|
||||||
hudstruct->Microphone.ysize=10;
|
|
||||||
|
|
||||||
SetHudDummy(&hudstruct->Dummy);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the firmware settings */
|
/* the firmware settings */
|
||||||
struct NDS_fw_config_data win_fw_config;
|
struct NDS_fw_config_data win_fw_config;
|
||||||
|
|
||||||
|
@ -1024,8 +906,6 @@ DWORD WINAPI run()
|
||||||
CallRegisteredLuaFunctions(LUACALL_BEFOREEMULATION);
|
CallRegisteredLuaFunctions(LUACALL_BEFOREEMULATION);
|
||||||
FCEUMOV_AddInputState();
|
FCEUMOV_AddInputState();
|
||||||
|
|
||||||
if (ShowInputDisplay) osd->addFixed(Hud.InputDisplay.x, Hud.InputDisplay.y, "%s",InputDisplayString.c_str());
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Lock lock;
|
Lock lock;
|
||||||
NDS_exec<false>();
|
NDS_exec<false>();
|
||||||
|
@ -1037,20 +917,11 @@ DWORD WINAPI run()
|
||||||
|
|
||||||
static int fps3d = 0;
|
static int fps3d = 0;
|
||||||
|
|
||||||
if (FpsDisplay) osd->addFixed(Hud.FpsDisplay.x, Hud.FpsDisplay.y, "Fps:%02d/%02d", fps, fps3d);
|
Hud.fps = fps;
|
||||||
if (frameCounterDisplay)
|
Hud.fps3d = fps3d;
|
||||||
{
|
|
||||||
if (movieMode == MOVIEMODE_PLAY)
|
|
||||||
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d/%d",currFrameCounter,currMovieData.records.size());
|
|
||||||
else if(movieMode == MOVIEMODE_RECORD)
|
|
||||||
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d",currFrameCounter);
|
|
||||||
else
|
|
||||||
osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter);
|
|
||||||
}
|
|
||||||
if (ShowLagFrameCounter) osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames);
|
|
||||||
if (ShowMicrophone) osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay);
|
|
||||||
|
|
||||||
if(!AVI_IsRecording()) osd->update();
|
osd->update();
|
||||||
|
DrawHUD();
|
||||||
Display();
|
Display();
|
||||||
osd->clear();
|
osd->clear();
|
||||||
|
|
||||||
|
@ -1540,13 +1411,15 @@ int _main()
|
||||||
windowSize = GetPrivateProfileInt("Video","Window Size", 0, IniName);
|
windowSize = GetPrivateProfileInt("Video","Window Size", 0, IniName);
|
||||||
GPU_rotation = GetPrivateProfileInt("Video","Window Rotate", 0, IniName);
|
GPU_rotation = GetPrivateProfileInt("Video","Window Rotate", 0, IniName);
|
||||||
ForceRatio = GetPrivateProfileInt("Video","Window Force Ratio", 1, IniName);
|
ForceRatio = GetPrivateProfileInt("Video","Window Force Ratio", 1, IniName);
|
||||||
FpsDisplay = GetPrivateProfileInt("Display","Display Fps", 0, IniName);
|
|
||||||
WndX = GetPrivateProfileInt("Video","WindowPosX", CW_USEDEFAULT, IniName);
|
WndX = GetPrivateProfileInt("Video","WindowPosX", CW_USEDEFAULT, IniName);
|
||||||
WndY = GetPrivateProfileInt("Video","WindowPosY", CW_USEDEFAULT, IniName);
|
WndY = GetPrivateProfileInt("Video","WindowPosY", CW_USEDEFAULT, IniName);
|
||||||
frameCounterDisplay = GetPrivateProfileInt("Display","FrameCounter", 0, IniName);
|
|
||||||
ShowInputDisplay = GetPrivateProfileInt("Display","Display Input", 0, IniName);
|
CommonSettings.hud.FpsDisplay = GetPrivateProfileBool("Display","Display Fps", 0, IniName);
|
||||||
ShowLagFrameCounter = GetPrivateProfileInt("Display","Display Lag Counter", 0, IniName);
|
CommonSettings.hud.FrameCounterDisplay = GetPrivateProfileBool("Display","FrameCounter", 0, IniName);
|
||||||
ShowMicrophone = GetPrivateProfileInt("Display","Display Microphone", 0, IniName);
|
CommonSettings.hud.ShowInputDisplay = GetPrivateProfileBool("Display","Display Input", 0, IniName);
|
||||||
|
CommonSettings.hud.ShowLagFrameCounter = GetPrivateProfileBool("Display","Display Lag Counter", 0, IniName);
|
||||||
|
CommonSettings.hud.ShowMicrophone = GetPrivateProfileBool("Display","Display Microphone", 0, IniName);
|
||||||
|
|
||||||
ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName);
|
ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName);
|
||||||
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
|
FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName);
|
||||||
CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0;
|
CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0;
|
||||||
|
@ -2674,11 +2547,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
MainWindow->checkMenu(IDM_SCREENSEP_NDSGAP, MF_BYCOMMAND | ((ScreenGap==64)?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(IDM_SCREENSEP_NDSGAP, MF_BYCOMMAND | ((ScreenGap==64)?MF_CHECKED:MF_UNCHECKED));
|
||||||
|
|
||||||
//Counters / Etc.
|
//Counters / Etc.
|
||||||
MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, MF_BYCOMMAND | ((frameCounterDisplay)?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, MF_BYCOMMAND | ((CommonSettings.hud.FrameCounterDisplay)?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, MF_BYCOMMAND | ((FpsDisplay) ?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, MF_BYCOMMAND | ((CommonSettings.hud.FpsDisplay) ?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, MF_BYCOMMAND | ((ShowInputDisplay) ?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, MF_BYCOMMAND | ((CommonSettings.hud.ShowInputDisplay) ?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, MF_BYCOMMAND | ((ShowLagFrameCounter)?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, MF_BYCOMMAND | ((CommonSettings.hud.ShowLagFrameCounter)?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, MF_BYCOMMAND | ((ShowMicrophone)?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, MF_BYCOMMAND | ((CommonSettings.hud.ShowMicrophone)?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(ID_VIEW_HUDEDITOR, MF_BYCOMMAND | ((HudEditorMode) ?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(ID_VIEW_HUDEDITOR, MF_BYCOMMAND | ((HudEditorMode) ?MF_CHECKED:MF_UNCHECKED));
|
||||||
MainWindow->checkMenu(IDC_FRAMELIMIT, MF_BYCOMMAND | ((FrameLimit) ?MF_CHECKED:MF_UNCHECKED));
|
MainWindow->checkMenu(IDC_FRAMELIMIT, MF_BYCOMMAND | ((FrameLimit) ?MF_CHECKED:MF_UNCHECKED));
|
||||||
|
|
||||||
|
@ -2747,7 +2620,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
WritePrivateProfileInt("Video", "WindowPosY", WndY/*MainWindowRect.top*/, IniName);
|
WritePrivateProfileInt("Video", "WindowPosY", WndY/*MainWindowRect.top*/, IniName);
|
||||||
|
|
||||||
//Save frame counter status
|
//Save frame counter status
|
||||||
WritePrivateProfileInt("Display", "FrameCounter", frameCounterDisplay, IniName);
|
WritePrivateProfileInt("Display", "FrameCounter", CommonSettings.hud.FrameCounterDisplay, IniName);
|
||||||
WritePrivateProfileInt("Display", "ScreenGap", ScreenGap, IniName);
|
WritePrivateProfileInt("Display", "ScreenGap", ScreenGap, IniName);
|
||||||
|
|
||||||
//Save Ram Watch information
|
//Save Ram Watch information
|
||||||
|
@ -3398,28 +3271,29 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
FCEUI_StopMovie();
|
FCEUI_StopMovie();
|
||||||
return 0;
|
return 0;
|
||||||
case ID_VIEW_FRAMECOUNTER:
|
case ID_VIEW_FRAMECOUNTER:
|
||||||
frameCounterDisplay ^= 1;
|
CommonSettings.hud.FrameCounterDisplay ^= true;
|
||||||
MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, frameCounterDisplay ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_FRAMECOUNTER, CommonSettings.hud.FrameCounterDisplay ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ID_VIEW_DISPLAYFPS:
|
case ID_VIEW_DISPLAYFPS:
|
||||||
FpsDisplay ^= 1;
|
CommonSettings.hud.FpsDisplay ^= true;
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, FpsDisplay ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYFPS, CommonSettings.hud.FpsDisplay ? MF_CHECKED : MF_UNCHECKED);
|
||||||
WritePrivateProfileInt("Display", "Display Fps", FpsDisplay, IniName);
|
WritePrivateProfileBool("Display", "Display Fps", CommonSettings.hud.FpsDisplay, IniName);
|
||||||
osd->clear();
|
osd->clear();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ID_VIEW_DISPLAYINPUT:
|
case ID_VIEW_DISPLAYINPUT:
|
||||||
ShowInputDisplay ^= 1;
|
CommonSettings.hud.ShowInputDisplay ^= true;
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, ShowInputDisplay ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYINPUT, CommonSettings.hud.ShowInputDisplay ? MF_CHECKED : MF_UNCHECKED);
|
||||||
WritePrivateProfileInt("Display", "Display Input", ShowInputDisplay, IniName);
|
WritePrivateProfileBool("Display", "Display Input", CommonSettings.hud.ShowInputDisplay, IniName);
|
||||||
osd->clear();
|
osd->clear();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ID_VIEW_DISPLAYLAG:
|
case ID_VIEW_DISPLAYLAG:
|
||||||
ShowLagFrameCounter ^= 1;
|
CommonSettings.hud.ShowLagFrameCounter ^= true;
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, ShowLagFrameCounter ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYLAG, CommonSettings.hud.ShowLagFrameCounter ? MF_CHECKED : MF_UNCHECKED);
|
||||||
WritePrivateProfileInt("Display", "Display Lag Counter", ShowLagFrameCounter, IniName);
|
WritePrivateProfileBool("Display", "Display Lag Counter", CommonSettings.hud.ShowLagFrameCounter, IniName);
|
||||||
osd->clear();
|
osd->clear();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -3431,9 +3305,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case ID_VIEW_DISPLAYMICROPHONE:
|
case ID_VIEW_DISPLAYMICROPHONE:
|
||||||
ShowMicrophone ^= 1;
|
CommonSettings.hud.ShowMicrophone ^= true;
|
||||||
MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, ShowMicrophone ? MF_CHECKED : MF_UNCHECKED);
|
MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE, CommonSettings.hud.ShowMicrophone ? MF_CHECKED : MF_UNCHECKED);
|
||||||
WritePrivateProfileInt("Display", "Display Microphone", ShowMicrophone, IniName);
|
WritePrivateProfileBool("Display", "Display Microphone", CommonSettings.hud.ShowMicrophone, IniName);
|
||||||
osd->clear();
|
osd->clear();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue