fceugx/source/fceusupport.cpp

180 lines
4.7 KiB
C++
Raw Normal View History

2009-07-17 19:27:04 +02:00
/****************************************************************************
2009-07-22 04:05:49 +02:00
* FCE Ultra
* Nintendo Wii/Gamecube Port
*
* Tantric 2008-2009
*
* fceusupport.cpp
*
2009-07-17 19:27:04 +02:00
* FCEU Support Functions
****************************************************************************/
2009-07-22 04:05:49 +02:00
2010-08-29 23:15:42 +02:00
#include <gctypes.h>
2010-03-22 00:49:24 +01:00
#include "fceugx.h"
2009-07-17 19:27:04 +02:00
#include "fceusupport.h"
#include "pad.h"
#include "gcaudio.h"
#include "gcvideo.h"
#include "menu.h"
2009-07-17 19:27:04 +02:00
2010-08-29 23:15:42 +02:00
bool turbo = false;
bool paldeemphswap = 0;
int dendy;
bool swapDuty;
int KillFCEUXonFrame = 0;
2010-08-29 23:15:42 +02:00
2009-07-17 19:27:04 +02:00
/**
* Closes a game. Frees memory, and deinitializes the drivers.
*/
int
CloseGame()
{
if(!romLoaded) {
return(0);
}
FCEUI_CloseGame();
GameInfo = 0;
return(1);
}
// File Control
FILE *FCEUD_UTF8fopen(const char *n, const char *m)
{
return NULL;
}
2010-08-29 23:15:42 +02:00
EMUFILE_FILE* FCEUD_UTF8_fstream(const char *n, const char *m)
2009-07-17 19:27:04 +02:00
{
return NULL;
}
bool FCEUD_ShouldDrawInputAids()
{
return GCSettings.crosshair;
2009-07-17 19:27:04 +02:00
}
// General Logging
void FCEUD_PrintError(const char *errormsg)
{
2009-07-23 07:39:43 +02:00
//if(GuiLoaded())
// ErrorPrompt(errormsg);
2009-07-17 19:27:04 +02:00
}
void FCEUD_Message(const char *text)
{
}
void FCEUD_VideoChanged()
{
}
2012-12-14 18:18:20 +01:00
static unsigned int keys[256] = {0,}; // with repeat
unsigned int *GetKeyboard(void)
{
return(keys);
}
2009-07-17 19:27:04 +02:00
FCEUFILE* FCEUD_OpenArchiveIndex(ArchiveScanRecord& asr, std::string &fname, int innerIndex) { return 0; }
FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename) { return 0; }
ArchiveScanRecord FCEUD_ScanArchive(std::string fname) { return ArchiveScanRecord(); }
// main interface to FCE Ultra
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int32 Count)
{
if(Buffer && Count > 0)
PlaySound(Buffer, Count); // play sound
if(XBuf)
RenderFrame(XBuf); // output video frame
GetJoy(); // check controller input
2009-07-17 19:27:04 +02:00
}
//CAK: Stereoscopic 3D Update functions
//CAK: This buffer saves the previous frame (usually the left eye)
// so it can be mixed with the current frame (usually the right eye)
uint8 XBufLeft[256*256];
//CAK: This uses the previous frame for the right eye, and the current frame for the left eye
// It then sets the previous frame to the current frame. This is only for the Orb-3D game, and hasn't
// been tested yet. Probably more than one frame difference will be needed, which requires a circluar
// buffer of several frames.
void FCEUD_UpdatePulfrich(uint8 *XBuf, int32 *Buffer, int32 Count)
{
if(Buffer && Count > 0)
PlaySound(Buffer, Count); // play sound
if(XBuf) {
RenderStereoFrames(XBuf, XBufLeft); // output video frame
memcpy(XBufLeft, XBuf, sizeof(XBufLeft)); // output video frame
}
GetJoy(); // check controller input
}
//CAK: This doesn't actually draw anything, it just saves the frame in a buffer while we wait
// for the corresponding right frame.
void FCEUD_UpdateLeft(uint8 *XBuf, int32 *Buffer, int32 Count)
{
if (Buffer && Count > 0)
PlaySound(Buffer, Count); // play sound
if (XBuf)
memcpy(XBufLeft, XBuf, sizeof(XBufLeft)); // output video frame
GetJoy(); // check controller input
}
//CAK: This draws the saved left frame and the passed in right frame together in 3D.
// How it so isn't relevant to this function, since the stereoscopic methods are handled in gcvideo.cpp
void FCEUD_UpdateRight(uint8 *XBuf, int32 *Buffer, int32 Count)
{
if (Buffer && Count > 0)
PlaySound(Buffer, Count); // play sound
if (XBuf)
RenderStereoFrames(XBufLeft, XBuf); // output video frames
GetJoy(); // check controller input
}
2009-07-17 19:27:04 +02:00
// Netplay
int FCEUD_SendData(void *data, uint32 len)
{
return 1;
}
int FCEUD_RecvData(void *data, uint32 len)
{
return 0;
}
void FCEUD_NetworkClose(void)
{
}
void FCEUD_NetplayText(uint8 *text)
{
}
// dummy functions
#define DUMMY(f) void f(void) { }
DUMMY(FCEUD_HideMenuToggle)
DUMMY(FCEUD_TurboOn)
DUMMY(FCEUD_TurboOff)
2010-04-15 01:54:57 +02:00
DUMMY(FCEUD_TurboToggle)
2009-07-17 19:27:04 +02:00
DUMMY(FCEUD_SaveStateAs)
DUMMY(FCEUD_LoadStateFrom)
DUMMY(FCEUD_MovieRecordTo)
DUMMY(FCEUD_MovieReplayFrom)
DUMMY(FCEUD_ToggleStatusIcon)
2010-04-15 01:54:57 +02:00
DUMMY(FCEUD_DebugBreakpoint)
DUMMY(FCEUD_SoundToggle)
2009-07-17 19:27:04 +02:00
DUMMY(FCEUD_AviRecordTo)
DUMMY(FCEUD_AviStop)
void FCEUI_AviVideoUpdate(const unsigned char* buffer) { }
int FCEUD_ShowStatusIcon(void) { return 0; }
bool FCEUI_AviIsRecording(void) { return 0; }
2012-01-09 02:59:06 +01:00
bool FCEUI_AviEnableHUDrecording() { return 0; }
void FCEUI_SetAviEnableHUDrecording(bool enable) { }
2010-04-15 01:54:57 +02:00
bool FCEUI_AviDisableMovieMessages() { return true; }
const char *FCEUD_GetCompilerString() { return NULL; }
void FCEUI_UseInputPreset(int preset) { }
void FCEUD_SoundVolumeAdjust(int n) { }
void FCEUD_SetEmulationSpeed(int cmd) { }
void GetMouseData(uint32 (&d)[3]) { }