mirror of
https://github.com/libretro/RetroArch
synced 2025-02-26 06:40:39 +00:00
Merge pull request #31 from freakdave/master
(Xbox 1) Added a simple GUI
This commit is contained in:
commit
4c96ce8054
83
xbox1/RetroLaunch/Debug.cpp
Normal file
83
xbox1/RetroLaunch/Debug.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "Global.h"
|
||||
#include "Debug.h"
|
||||
|
||||
CDebug g_debug;
|
||||
|
||||
CDebug::CDebug(void)
|
||||
{
|
||||
iLine = 1;
|
||||
m_bFileOpen = false;
|
||||
}
|
||||
|
||||
CDebug::~CDebug(void)
|
||||
{
|
||||
}
|
||||
|
||||
void CDebug::Print(char *szMessage, ...)
|
||||
{
|
||||
char szMsg[512];
|
||||
va_list vaArgList;
|
||||
string szDebugFile ("D:\\debug.log");//(FixPath(PathRoot() + "debug.log"));
|
||||
|
||||
va_start(vaArgList, szMessage);
|
||||
vsprintf(szMsg, szMessage, vaArgList);
|
||||
va_end(vaArgList);
|
||||
|
||||
OutputDebugStringA(IntToString(iLine).c_str());
|
||||
OutputDebugStringA(": ");
|
||||
OutputDebugStringA(szMsg);
|
||||
OutputDebugStringA("\n\n");
|
||||
|
||||
#ifdef WIN32
|
||||
cout << IntToString(iLine)<< ": " << szMsg << endl << endl;
|
||||
#endif
|
||||
|
||||
//#ifdef _LOG
|
||||
//Open the log file, create one if it does not exist, append the data
|
||||
if(!m_bFileOpen)
|
||||
{
|
||||
fp = fopen(szDebugFile.c_str(), "w+");
|
||||
m_bFileOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = fopen(szDebugFile.c_str(), "a+");
|
||||
}
|
||||
|
||||
//print the data to the log file
|
||||
fprintf(fp, IntToString(iLine).c_str());
|
||||
fprintf(fp, ": ");
|
||||
fprintf(fp, szMsg);
|
||||
fprintf(fp, "\r\n\r\n");
|
||||
|
||||
//close the file
|
||||
fclose(fp);
|
||||
//#endif //_LOG
|
||||
|
||||
iLine ++;
|
||||
}
|
||||
|
||||
|
||||
string CDebug::IntToString(int value)
|
||||
{
|
||||
stringstream ss;
|
||||
|
||||
ss << value;
|
||||
|
||||
return ss.str();
|
||||
}
|
41
xbox1/RetroLaunch/Debug.h
Normal file
41
xbox1/RetroLaunch/Debug.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#ifndef _DEBUG_H__DASH_
|
||||
#define _DEBUG_H__DASH_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif //_MSC_VER > 1000
|
||||
|
||||
class CDebug
|
||||
{
|
||||
public:
|
||||
CDebug();
|
||||
~CDebug();
|
||||
|
||||
void Print(char *szMessage, ...);
|
||||
string IntToString(int value);
|
||||
|
||||
private:
|
||||
int iLine;
|
||||
FILE *fp;
|
||||
bool m_bFileOpen;
|
||||
|
||||
};
|
||||
|
||||
extern CDebug g_debug;
|
||||
|
||||
#endif //_DEBUG_H__DASH_
|
229
xbox1/RetroLaunch/Font.cpp
Normal file
229
xbox1/RetroLaunch/Font.cpp
Normal file
@ -0,0 +1,229 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "Font.h"
|
||||
|
||||
#include <xgraphics.h>
|
||||
|
||||
Font g_font;
|
||||
|
||||
Font::Font(void)
|
||||
{
|
||||
m_pFont = NULL;
|
||||
}
|
||||
|
||||
Font::~Font(void)
|
||||
{
|
||||
if (m_pFont)
|
||||
m_pFont->Release();
|
||||
}
|
||||
|
||||
bool Font::Create()
|
||||
{ //Hardcoded
|
||||
return Create("D:\\Media\\arial.ttf");
|
||||
}
|
||||
|
||||
bool Font::Create(const string &szTTFFilename)
|
||||
{
|
||||
if (m_pFont)
|
||||
m_pFont->Release();
|
||||
|
||||
word *wcPathBuf = StringToWChar(szTTFFilename);
|
||||
g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
|
||||
|
||||
delete [] wcPathBuf;
|
||||
|
||||
if (FAILED(g_hResult))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Font::Render(const string &str, int x, int y, dword height, dword style, D3DXCOLOR color, int maxWidth, bool fade, Align alignment)
|
||||
{
|
||||
CSurface texture;
|
||||
RenderToTexture(texture, str, height, style, color, maxWidth, fade);
|
||||
|
||||
if (alignment != Left)
|
||||
{
|
||||
word *wcBuf = StringToWChar(str);
|
||||
dword dwRequiredWidth;
|
||||
m_pFont->GetTextExtent(wcBuf, -1, &dwRequiredWidth);
|
||||
delete [] wcBuf;
|
||||
|
||||
if (alignment == Center)
|
||||
{
|
||||
x -= (dwRequiredWidth / 2);
|
||||
}
|
||||
else if (alignment == Right)
|
||||
{
|
||||
x -= dwRequiredWidth;
|
||||
}
|
||||
}
|
||||
|
||||
texture.Render(x, y);
|
||||
}
|
||||
|
||||
void Font::RenderToTexture(CSurface &texture, const string &str, dword height, dword style, D3DXCOLOR color, int maxWidth, bool fade)
|
||||
{
|
||||
if (m_pFont == NULL)
|
||||
return;
|
||||
|
||||
m_pFont->SetTextHeight(height);
|
||||
m_pFont->SetTextStyle(style);
|
||||
m_pFont->SetTextColor(color);
|
||||
|
||||
dword dwMaxWidth = (maxWidth <= 0) ? 1000 : maxWidth;
|
||||
|
||||
// get the exact width and height required to display the string
|
||||
dword dwRequiredWidth = GetRequiredWidth(str, height, style);
|
||||
dword dwRequiredHeight = GetRequiredHeight(str, height, style);;
|
||||
|
||||
// calculate the texture width and height needed to display the font
|
||||
dword dwTextureWidth = dwRequiredWidth * 2;
|
||||
dword dwTextureHeight = dwRequiredHeight * 2;
|
||||
{
|
||||
// because the textures are swizzled we make sure
|
||||
// the dimensions are a power of two
|
||||
for(dword wmask = 1; dwTextureWidth &(dwTextureWidth - 1); wmask = (wmask << 1 ) + 1)
|
||||
{
|
||||
dwTextureWidth = (dwTextureWidth + wmask) & ~wmask;
|
||||
}
|
||||
for(dword hmask = 1; dwTextureHeight &(dwTextureHeight - 1); hmask = (hmask << 1) + 1)
|
||||
{
|
||||
dwTextureHeight = ( dwTextureHeight + hmask ) & ~hmask;
|
||||
}
|
||||
|
||||
// also enforce a minimum pitch of 64 bytes
|
||||
dwTextureWidth = max(64 / XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8), dwTextureWidth);
|
||||
}
|
||||
|
||||
// create an temporary image surface to render to
|
||||
D3DSurface *pTempSurface;
|
||||
g_video.m_pD3DDevice->CreateImageSurface(dwTextureWidth, dwTextureHeight, D3DFMT_LIN_A8R8G8B8, &pTempSurface);
|
||||
|
||||
// clear the temporary surface
|
||||
{
|
||||
D3DLOCKED_RECT tmpLr;
|
||||
pTempSurface->LockRect(&tmpLr, NULL, 0);
|
||||
memset(tmpLr.pBits, 0, dwTextureWidth * dwTextureHeight * XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8));
|
||||
pTempSurface->UnlockRect();
|
||||
}
|
||||
|
||||
// render the text to the temporary surface
|
||||
word *wcBuf = StringToWChar(str);
|
||||
m_pFont->TextOut(pTempSurface, wcBuf, -1, 0, 0);
|
||||
delete [] wcBuf;
|
||||
|
||||
// create the texture that will be drawn to the screen
|
||||
texture.Destroy();
|
||||
texture.Create(dwTextureWidth, dwTextureHeight);
|
||||
|
||||
// copy from the temporary surface to the final texture
|
||||
{
|
||||
D3DLOCKED_RECT tmpLr;
|
||||
D3DLOCKED_RECT txtLr;
|
||||
|
||||
pTempSurface->LockRect(&tmpLr, NULL, 0);
|
||||
texture.GetTexture()->LockRect(0, &txtLr, NULL, 0);
|
||||
|
||||
if (fade)
|
||||
{
|
||||
// draw the last 35 pixels of the string fading out to max width or texture width
|
||||
dword dwMinFadeDistance = min(static_cast<dword>(dwTextureWidth * 0.35), 35);
|
||||
dword dwFadeStart = min(dwTextureWidth, dwMaxWidth - dwMinFadeDistance);
|
||||
dword dwFadeEnd = min(dwTextureWidth, dwMaxWidth);
|
||||
dword dwFadeDistance = dwFadeEnd - dwFadeStart;
|
||||
|
||||
for (dword h = 0; h < dwTextureHeight; h++)
|
||||
{
|
||||
for (dword w = 0; w < dwFadeDistance; w++)
|
||||
{
|
||||
dword *pColor = reinterpret_cast<dword *>(tmpLr.pBits);
|
||||
dword offset = (h * dwTextureWidth) + (dwFadeStart + w);
|
||||
|
||||
D3DXCOLOR color = D3DXCOLOR(pColor[offset]);
|
||||
color.a = color.a * (1.0f - static_cast<float>(w) / static_cast<float>(dwFadeDistance));
|
||||
pColor[offset] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dont draw anything > than max width
|
||||
for (dword h = 0; h < dwTextureHeight; h++)
|
||||
{
|
||||
for (dword w = min(dwTextureWidth, dwMaxWidth); w < dwTextureWidth; w++)
|
||||
{
|
||||
dword *pColor = reinterpret_cast<dword *>(tmpLr.pBits);
|
||||
dword offset = (h * dwTextureWidth) + w;
|
||||
|
||||
D3DXCOLOR color = D3DXCOLOR(pColor[offset]);
|
||||
color.a = 0.0;
|
||||
pColor[offset] = color;
|
||||
}
|
||||
}
|
||||
|
||||
// copy and swizzle the linear surface to the swizzled texture
|
||||
XGSwizzleRect(tmpLr.pBits, tmpLr.Pitch, NULL, txtLr.pBits, dwTextureWidth, dwTextureHeight, NULL, 4);
|
||||
|
||||
texture.GetTexture()->UnlockRect(0);
|
||||
pTempSurface->UnlockRect();
|
||||
}
|
||||
|
||||
pTempSurface->Release();
|
||||
}
|
||||
|
||||
int Font::GetRequiredWidth(const string &str, dword height, dword style)
|
||||
{
|
||||
word *wcBuf = StringToWChar(str);
|
||||
dword reqWidth;
|
||||
|
||||
m_pFont->SetTextHeight(height);
|
||||
m_pFont->SetTextStyle(style);
|
||||
m_pFont->GetTextExtent(wcBuf, -1, &reqWidth);
|
||||
|
||||
delete [] wcBuf;
|
||||
|
||||
return reqWidth;
|
||||
}
|
||||
|
||||
int Font::GetRequiredHeight(const string &str, dword height, dword style)
|
||||
{
|
||||
word *wcBuf = StringToWChar(str);
|
||||
dword reqHeight;
|
||||
|
||||
m_pFont->SetTextHeight(height);
|
||||
m_pFont->SetTextStyle(style);
|
||||
m_pFont->GetFontMetrics(&reqHeight, NULL);
|
||||
|
||||
delete [] wcBuf;
|
||||
|
||||
return reqHeight;
|
||||
}
|
||||
|
||||
|
||||
word *Font::StringToWChar(const string &str)
|
||||
{
|
||||
word *retVal = new word[(str.length() + 1) * 2];
|
||||
memset(retVal, 0, (str.length() + 1) * 2 * sizeof(word));
|
||||
|
||||
if (str.length() > 0)
|
||||
mbstowcs(retVal, str.c_str(), str.length());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
#endif
|
53
xbox1/RetroLaunch/Font.h
Normal file
53
xbox1/RetroLaunch/Font.h
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifdef _XBOX
|
||||
#include "Global.h"
|
||||
#include "Surface.h"
|
||||
|
||||
#define XFONT_TRUETYPE // use true type fonts
|
||||
#include <xfont.h>
|
||||
|
||||
enum Align
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
};
|
||||
|
||||
class Font
|
||||
{
|
||||
public:
|
||||
Font(void);
|
||||
~Font(void);
|
||||
|
||||
bool Create();
|
||||
bool Create(const string &szTTFFilename);
|
||||
|
||||
void Render(const string &str, int x, int y, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int dwMaxWidth = -1, bool fade = false, Align alignment = Left);
|
||||
void RenderToTexture(CSurface &texture, const string &str, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int maxWidth = -1, bool fade = false);
|
||||
|
||||
int GetRequiredWidth(const string &str, dword height, dword style);
|
||||
int GetRequiredHeight(const string &str, dword height, dword style);
|
||||
|
||||
word *StringToWChar(const string &str);
|
||||
|
||||
private:
|
||||
XFONT *m_pFont;
|
||||
};
|
||||
|
||||
extern Font g_font;
|
||||
#endif
|
53
xbox1/RetroLaunch/Global.h
Normal file
53
xbox1/RetroLaunch/Global.h
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <io.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <direct.h>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#include <xgraphics.h>
|
||||
#else
|
||||
#pragma comment(lib,"d3d8.lib")
|
||||
#pragma comment(lib,"d3dx8.lib")
|
||||
#pragma comment(lib,"DxErr8.lib")
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <d3d8.h>
|
||||
#include <d3dx8.h>
|
||||
#include <dxerr8.h>
|
||||
#endif
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define XBUILD "Launcher CE"
|
||||
|
||||
typedef unsigned __int8 byte;
|
||||
typedef unsigned __int16 word;
|
||||
typedef unsigned __int32 dword;
|
||||
typedef unsigned __int64 qword;
|
||||
|
||||
|
152
xbox1/RetroLaunch/IniFile.cpp
Normal file
152
xbox1/RetroLaunch/IniFile.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "SimpleIni.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
|
||||
IniFile g_iniFile;
|
||||
|
||||
//FIXME: SCREEN XPOS, YPOS, XSCALE, YSCALE should be floats!
|
||||
//FIXME: Path for WIN32
|
||||
|
||||
IniFile::IniFile(void)
|
||||
{
|
||||
}
|
||||
|
||||
IniFile::~IniFile(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool IniFile::Save(const string &szIniFileName)
|
||||
{
|
||||
CSimpleIniA ini;
|
||||
SI_Error rc;
|
||||
ini.SetUnicode(true);
|
||||
ini.SetMultiKey(true);
|
||||
ini.SetMultiLine(true);
|
||||
|
||||
//GENERAL SETTINGS
|
||||
ini.SetBoolValue("GENERAL SETTINGS", "SHOW DEBUG INFO", m_currentIniEntry.bShowDebugInfo);
|
||||
|
||||
//VIDEO SETTINGS
|
||||
ini.SetBoolValue("VIDEO SETTINGS", "AUTOMATIC FRAME SKIP", m_currentIniEntry.bAutomaticFrameSkip);
|
||||
|
||||
rc = ini.SaveFile(szIniFileName.c_str());
|
||||
|
||||
OutputDebugStringA(szIniFileName.c_str());
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
OutputDebugStringA(" failed to save!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
OutputDebugStringA(" saved successfully!\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IniFile::Load(const string &szIniFileName)
|
||||
{
|
||||
CSimpleIniA ini;
|
||||
SI_Error rc;
|
||||
ini.SetUnicode(true);
|
||||
ini.SetMultiKey(true);
|
||||
ini.SetMultiLine(true);
|
||||
|
||||
rc = ini.LoadFile(szIniFileName.c_str());
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
OutputDebugString("Failed to load ");
|
||||
OutputDebugString(szIniFileName.c_str());
|
||||
OutputDebugString("\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
OutputDebugStringA("Successfully loaded ");
|
||||
OutputDebugString(szIniFileName.c_str());
|
||||
OutputDebugString("\n");
|
||||
|
||||
//GENERAL SETTINGS
|
||||
m_currentIniEntry.bShowDebugInfo = ini.GetBoolValue("GENERAL SETTINGS", "SHOW DEBUG INFO", NULL );
|
||||
|
||||
//VIDEO SETTINGS
|
||||
m_currentIniEntry.bAutomaticFrameSkip = ini.GetBoolValue("VIDEO SETTINGS", "AUTOMATIC FRAME SKIP", NULL );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IniFile::CreateAndSaveDefaultIniEntry()
|
||||
{
|
||||
//GENERAL SETTINGS
|
||||
m_defaultIniEntry.bShowDebugInfo = false;
|
||||
|
||||
//VIDEO SETTINGS
|
||||
m_defaultIniEntry.bAutomaticFrameSkip = true;
|
||||
|
||||
// our current ini is now the default ini
|
||||
m_currentIniEntry = m_defaultIniEntry;
|
||||
|
||||
// save the default ini
|
||||
// FIXME! -> CD/DVD -> utility drive X:
|
||||
Save("D:\\retrolaunch.ini");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool IniFile::CheckForIniEntry()
|
||||
{
|
||||
// try to load our ini file
|
||||
if(!Load("D:\\retrolaunch.ini"))
|
||||
{
|
||||
// create a new one, if it doesn't exist
|
||||
CreateAndSaveDefaultIniEntry();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool IniFile::SaveTempRomFileName(const string &szFileName)
|
||||
{
|
||||
CSimpleIniA ini;
|
||||
SI_Error rc;
|
||||
ini.SetUnicode(true);
|
||||
ini.SetMultiKey(true);
|
||||
ini.SetMultiLine(true);
|
||||
|
||||
ini.SetValue("LAUNCHER", "ROM", szFileName.c_str());
|
||||
|
||||
DeleteFile("T:\\tmp.retro");
|
||||
rc = ini.SaveFile("T:\\tmp.retro");
|
||||
|
||||
OutputDebugStringA("T:\\tmp.retro");
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
OutputDebugStringA(" failed to save!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
OutputDebugStringA(" saved successfully!\n");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
98
xbox1/RetroLaunch/IniFile.h
Normal file
98
xbox1/RetroLaunch/IniFile.h
Normal file
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
|
||||
struct IniFileEntry
|
||||
{
|
||||
//debug output
|
||||
bool bShowDebugInfo;
|
||||
|
||||
//automatic frame skip method
|
||||
bool bAutomaticFrameSkip;
|
||||
|
||||
//manual frame skip method (throttlespeed)
|
||||
bool bManualFrameSkip;
|
||||
|
||||
//number of frames to skip
|
||||
dword dwNumFrameSkips;
|
||||
|
||||
//sync audio to video
|
||||
bool bSyncAudioToVideo;
|
||||
|
||||
//vertical synchronization
|
||||
bool bVSync;
|
||||
|
||||
//flicker filter
|
||||
dword dwFlickerFilter;
|
||||
|
||||
//soft display filter
|
||||
bool bSoftDisplayFilter;
|
||||
|
||||
//texture filter
|
||||
DWORD dwTextureFilter;
|
||||
|
||||
//screen xpos
|
||||
dword dwXPOS;
|
||||
//screen ypos
|
||||
dword dwYPOS;
|
||||
//screen xscale
|
||||
dword dwXWIDTH;
|
||||
//screen yscale
|
||||
dword dwYHEIGHT;
|
||||
|
||||
//hide normal scroll 0
|
||||
bool bHideNBG0;
|
||||
//hide normal scroll 1
|
||||
bool bHideNBG1;
|
||||
//hide normal scroll 2
|
||||
bool bHideNBG2;
|
||||
//hide normal scroll 3
|
||||
bool bHideNBG3;
|
||||
//hide rotation scroll 0
|
||||
bool bHideRBG0;
|
||||
//hide VDP1
|
||||
bool bHideVDP1;
|
||||
};
|
||||
|
||||
|
||||
class IniFile
|
||||
{
|
||||
public:
|
||||
IniFile();
|
||||
~IniFile();
|
||||
|
||||
bool Save(const string &szIniFileName);
|
||||
bool SaveTempRomFileName(const string &szFileName);
|
||||
bool Load(const string &szIniFileName);
|
||||
bool CreateAndSaveDefaultIniEntry();
|
||||
bool CheckForIniEntry();
|
||||
|
||||
IniFileEntry m_currentIniEntry;
|
||||
|
||||
private:
|
||||
IniFileEntry m_defaultIniEntry;
|
||||
|
||||
string szRomFileName;
|
||||
|
||||
};
|
||||
|
||||
extern IniFile g_iniFile;
|
||||
|
||||
|
||||
|
||||
|
||||
|
328
xbox1/RetroLaunch/Input.cpp
Normal file
328
xbox1/RetroLaunch/Input.cpp
Normal file
@ -0,0 +1,328 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "Input.h"
|
||||
|
||||
Input g_input;
|
||||
|
||||
Input::Input(void)
|
||||
{
|
||||
m_pollingParameters.fAutoPoll = TRUE;
|
||||
m_pollingParameters.fInterruptOut = TRUE;
|
||||
m_pollingParameters.bInputInterval = 8;
|
||||
m_pollingParameters.bOutputInterval = 8;
|
||||
m_lastTick = GetTickCount();
|
||||
m_buttonDelay = XBINPUT_PRESS_BUTTON_DELAY;
|
||||
m_triggerDelay = XBINPUT_PRESS_TRIGGER_DELAY;
|
||||
m_buttonPressed = false;
|
||||
}
|
||||
|
||||
Input::~Input(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool Input::Create()
|
||||
{
|
||||
XInitDevices(0, NULL);
|
||||
|
||||
// get a mask of all currently available devices
|
||||
dword dwDeviceMask = XGetDevices(XDEVICE_TYPE_GAMEPAD);
|
||||
|
||||
// open the devices
|
||||
for(dword i = 0; i < XGetPortCount(); i++)
|
||||
{
|
||||
ZeroMemory(&m_inputStates[i], sizeof(XINPUT_STATE));
|
||||
ZeroMemory(&m_gamepads[i], sizeof(XBGAMEPAD));
|
||||
|
||||
if(dwDeviceMask & (1 << i))
|
||||
{
|
||||
// get a handle to the device
|
||||
m_gamepads[i].hDevice = XInputOpen(XDEVICE_TYPE_GAMEPAD, i,
|
||||
XDEVICE_NO_SLOT, &m_pollingParameters);
|
||||
|
||||
// store capabilities of the device
|
||||
XInputGetCapabilities(m_gamepads[i].hDevice, &m_gamepads[i].caps);
|
||||
|
||||
// initialize last pressed buttons
|
||||
XInputGetState(m_gamepads[i].hDevice, &m_inputStates[i]);
|
||||
|
||||
m_gamepads[i].wLastButtons = m_inputStates[i].Gamepad.wButtons;
|
||||
|
||||
for(dword b = 0; b < 8; b++)
|
||||
{
|
||||
m_gamepads[i].bLastAnalogButtons[b] =
|
||||
// Turn the 8-bit polled value into a boolean value
|
||||
(m_inputStates[i].Gamepad.bAnalogButtons[b] > XINPUT_GAMEPAD_MAX_CROSSTALK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Input::RefreshDevices()
|
||||
{
|
||||
dword dwInsertions, dwRemovals;
|
||||
|
||||
XGetDeviceChanges(XDEVICE_TYPE_GAMEPAD, reinterpret_cast<PDWORD>(&dwInsertions), reinterpret_cast<PDWORD>(&dwRemovals));
|
||||
|
||||
// loop through all gamepads
|
||||
for(dword i = 0; i < XGetPortCount(); i++)
|
||||
{
|
||||
// handle removed devices
|
||||
m_gamepads[i].bRemoved = (dwRemovals & (1 << i)) ? true : false;
|
||||
|
||||
if(m_gamepads[i].bRemoved)
|
||||
{
|
||||
// if the controller was removed after XGetDeviceChanges but before
|
||||
// XInputOpen, the device handle will be NULL
|
||||
if(m_gamepads[i].hDevice)
|
||||
XInputClose(m_gamepads[i].hDevice);
|
||||
|
||||
m_gamepads[i].hDevice = NULL;
|
||||
m_gamepads[i].Feedback.Rumble.wLeftMotorSpeed = 0;
|
||||
m_gamepads[i].Feedback.Rumble.wRightMotorSpeed = 0;
|
||||
}
|
||||
|
||||
// handle inserted devices
|
||||
m_gamepads[i].bInserted = (dwInsertions & (1 << i)) ? true : false;
|
||||
|
||||
if(m_gamepads[i].bInserted)
|
||||
{
|
||||
m_gamepads[i].hDevice = XInputOpen(XDEVICE_TYPE_GAMEPAD, i,
|
||||
XDEVICE_NO_SLOT, &m_pollingParameters );
|
||||
|
||||
// if the controller is removed after XGetDeviceChanges but before
|
||||
// XInputOpen, the device handle will be NULL
|
||||
if(m_gamepads[i].hDevice)
|
||||
{
|
||||
XInputGetCapabilities(m_gamepads[i].hDevice, &m_gamepads[i].caps);
|
||||
|
||||
// initialize last pressed buttons
|
||||
XInputGetState(m_gamepads[i].hDevice, &m_inputStates[i]);
|
||||
|
||||
m_gamepads[i].wLastButtons = m_inputStates[i].Gamepad.wButtons;
|
||||
|
||||
for(dword b = 0; b < 8; b++)
|
||||
{
|
||||
m_gamepads[i].bLastAnalogButtons[b] =
|
||||
// Turn the 8-bit polled value into a boolean value
|
||||
(m_inputStates[i].Gamepad.bAnalogButtons[b] > XINPUT_GAMEPAD_MAX_CROSSTALK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Input::GetInput()
|
||||
{
|
||||
RefreshDevices();
|
||||
|
||||
if (m_buttonPressed)
|
||||
{
|
||||
m_lastTick = GetTickCount();
|
||||
m_buttonPressed = false;
|
||||
}
|
||||
|
||||
// loop through all gamepads
|
||||
for(dword i = 0; i < XGetPortCount(); i++)
|
||||
{
|
||||
// if we have a valid device, poll it's state and track button changes
|
||||
if(m_gamepads[i].hDevice)
|
||||
{
|
||||
// read the input state
|
||||
XInputGetState(m_gamepads[i].hDevice, &m_inputStates[i]);
|
||||
|
||||
// copy gamepad to local structure
|
||||
memcpy(&m_gamepads[i], &m_inputStates[i].Gamepad, sizeof(XINPUT_GAMEPAD));
|
||||
|
||||
// put xbox device input for the gamepad into our custom format
|
||||
float fX1 = (m_gamepads[i].sThumbLX + 0.5f) / 32767.5f;
|
||||
m_gamepads[i].fX1 = (fX1 >= 0.0f ? 1.0f : -1.0f) *
|
||||
max(0.0f, (fabsf(fX1) - XBINPUT_DEADZONE) / (1.0f - XBINPUT_DEADZONE));
|
||||
|
||||
float fY1 = (m_gamepads[i].sThumbLY + 0.5f) / 32767.5f;
|
||||
m_gamepads[i].fY1 = (fY1 >= 0.0f ? 1.0f : -1.0f) *
|
||||
max(0.0f, (fabsf(fY1) - XBINPUT_DEADZONE) / (1.0f - XBINPUT_DEADZONE));
|
||||
|
||||
float fX2 = (m_gamepads[i].sThumbRX + 0.5f) / 32767.5f;
|
||||
m_gamepads[i].fX2 = (fX2 >= 0.0f ? 1.0f : -1.0f) *
|
||||
max(0.0f, (fabsf(fX2) - XBINPUT_DEADZONE) / (1.0f - XBINPUT_DEADZONE));
|
||||
|
||||
float fY2 = (m_gamepads[i].sThumbRY + 0.5f) / 32767.5f;
|
||||
m_gamepads[i].fY2 = (fY2 >= 0.0f ? 1.0f : -1.0f) *
|
||||
max(0.0f, (fabsf(fY2) - XBINPUT_DEADZONE) / (1.0f - XBINPUT_DEADZONE));
|
||||
|
||||
// get the boolean buttons that have been pressed since the last
|
||||
// call. each button is represented by one bit.
|
||||
m_gamepads[i].wPressedButtons = (m_gamepads[i].wLastButtons ^ m_gamepads[i].wButtons) & m_gamepads[i].wButtons;
|
||||
m_gamepads[i].wLastButtons = m_gamepads[i].wButtons;
|
||||
|
||||
// get the analog buttons that have been pressed or released since
|
||||
// the last call.
|
||||
for(dword b = 0; b < 8; b++)
|
||||
{
|
||||
// turn the 8-bit polled value into a boolean value
|
||||
bool bPressed = (m_gamepads[i].bAnalogButtons[b] > XINPUT_GAMEPAD_MAX_CROSSTALK);
|
||||
|
||||
if(bPressed)
|
||||
m_gamepads[i].bPressedAnalogButtons[b] = !m_gamepads[i].bLastAnalogButtons[b];
|
||||
else
|
||||
m_gamepads[i].bPressedAnalogButtons[b] = false;
|
||||
|
||||
// store the current state for the next time
|
||||
m_gamepads[i].bLastAnalogButtons[b] = bPressed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Input::IsButtonPressed(XboxButton button)
|
||||
{
|
||||
if (m_lastTick + m_buttonDelay > GetTickCount())
|
||||
return false;
|
||||
|
||||
bool buttonDown = false;
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case XboxLeftThumbLeft:
|
||||
buttonDown = (m_gamepads[0].fX1 < -0.5);
|
||||
break;
|
||||
case XboxLeftThumbRight:
|
||||
buttonDown = (m_gamepads[0].fX1 > 0.5);
|
||||
break;
|
||||
case XboxLeftThumbUp:
|
||||
buttonDown = (m_gamepads[0].fY1 > 0.5);
|
||||
break;
|
||||
case XboxLeftThumbDown:
|
||||
buttonDown = (m_gamepads[0].fY1 < -0.5);
|
||||
break;
|
||||
case XboxRightThumbLeft:
|
||||
buttonDown = (m_gamepads[0].fX2 < -0.5);
|
||||
break;
|
||||
case XboxRightThumbRight:
|
||||
buttonDown = (m_gamepads[0].fX2 > 0.5);
|
||||
break;
|
||||
case XboxRightThumbUp:
|
||||
buttonDown = (m_gamepads[0].fY2 > 0.5);
|
||||
break;
|
||||
case XboxRightThumbDown:
|
||||
buttonDown = (m_gamepads[0].fY2 < -0.5);
|
||||
break;
|
||||
case XboxDPadLeft:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_DPAD_LEFT) != 0);
|
||||
break;
|
||||
case XboxDPadRight:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) != 0);
|
||||
break;
|
||||
case XboxDPadUp:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_DPAD_UP) != 0);
|
||||
break;
|
||||
case XboxDPadDown:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_DPAD_DOWN) != 0);
|
||||
break;
|
||||
case XboxStart:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_START) != 0);
|
||||
break;
|
||||
case XboxBack:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_BACK) != 0);
|
||||
break;
|
||||
case XboxA:
|
||||
buttonDown = (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_A] > 30);
|
||||
break;
|
||||
case XboxB:
|
||||
buttonDown = (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_B] > 30);
|
||||
break;
|
||||
case XboxX:
|
||||
buttonDown = (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_X] > 30);
|
||||
break;
|
||||
case XboxY:
|
||||
buttonDown = (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_Y] > 30);
|
||||
break;
|
||||
case XboxWhite:
|
||||
buttonDown = (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_WHITE] > 30);
|
||||
break;
|
||||
case XboxBlack:
|
||||
buttonDown = (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_BLACK] > 30);
|
||||
break;
|
||||
case XboxLeftThumbButton:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_LEFT_THUMB) != 0);
|
||||
break;
|
||||
case XboxRightThumbButton:
|
||||
buttonDown = ((m_gamepads[0].wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) != 0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (buttonDown)
|
||||
{
|
||||
m_buttonPressed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
byte Input::IsLTriggerPressed()
|
||||
{
|
||||
if (m_lastTick + m_triggerDelay > GetTickCount())
|
||||
return 0;
|
||||
|
||||
if (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_LEFT_TRIGGER] < 30)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
m_buttonPressed = true;
|
||||
return m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_LEFT_TRIGGER];
|
||||
}
|
||||
}
|
||||
|
||||
byte Input::IsRTriggerPressed()
|
||||
{
|
||||
if (m_lastTick + m_triggerDelay > GetTickCount())
|
||||
return 0;
|
||||
|
||||
if (m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_RIGHT_TRIGGER] < 30)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
m_buttonPressed = true;
|
||||
return m_gamepads[0].bAnalogButtons[XINPUT_GAMEPAD_RIGHT_TRIGGER];
|
||||
}
|
||||
}
|
||||
|
||||
DWORD Input::GetButtonDelay()
|
||||
{
|
||||
return m_buttonDelay;
|
||||
}
|
||||
|
||||
void Input::SetButtonDelay(DWORD milliseconds)
|
||||
{
|
||||
m_buttonDelay = milliseconds;
|
||||
}
|
||||
|
||||
DWORD Input::GetTriggerDelay()
|
||||
{
|
||||
return m_triggerDelay;
|
||||
}
|
||||
|
||||
void Input::SetTriggerDelay(DWORD milliseconds)
|
||||
{
|
||||
m_triggerDelay = milliseconds;
|
||||
}
|
||||
#endif
|
171
xbox1/RetroLaunch/Input.h
Normal file
171
xbox1/RetroLaunch/Input.h
Normal file
@ -0,0 +1,171 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifdef _XBOX
|
||||
#include "Global.h"
|
||||
|
||||
#define XBINPUT_DEADZONE 0.24f
|
||||
#define XBINPUT_PRESS_BUTTON_DELAY 200
|
||||
#define XBINPUT_PRESS_TRIGGER_DELAY 100
|
||||
|
||||
struct XBGAMEPAD : public XINPUT_GAMEPAD
|
||||
{
|
||||
// thumb stick values converted to range [-1,+1]
|
||||
float fX1;
|
||||
float fY1;
|
||||
float fX2;
|
||||
float fY2;
|
||||
|
||||
// state of buttons tracked since last poll
|
||||
word wLastButtons;
|
||||
bool bLastAnalogButtons[8];
|
||||
word wPressedButtons;
|
||||
bool bPressedAnalogButtons[8];
|
||||
|
||||
// rumble properties
|
||||
XINPUT_RUMBLE Rumble;
|
||||
XINPUT_FEEDBACK Feedback;
|
||||
|
||||
// device properties
|
||||
XINPUT_CAPABILITIES caps;
|
||||
HANDLE hDevice;
|
||||
|
||||
// flags for whether game pad was just inserted or removed
|
||||
bool bInserted;
|
||||
bool bRemoved;
|
||||
};
|
||||
|
||||
#define XBOX_BUTTON_COUNT 23
|
||||
|
||||
enum XboxButton
|
||||
{
|
||||
XboxLeftThumbLeft,
|
||||
XboxLeftThumbRight,
|
||||
XboxLeftThumbUp,
|
||||
XboxLeftThumbDown,
|
||||
|
||||
XboxRightThumbLeft,
|
||||
XboxRightThumbRight,
|
||||
XboxRightThumbUp,
|
||||
XboxRightThumbDown,
|
||||
|
||||
XboxDPadLeft,
|
||||
XboxDPadRight,
|
||||
XboxDPadUp,
|
||||
XboxDPadDown,
|
||||
|
||||
XboxStart,
|
||||
XboxBack,
|
||||
|
||||
XboxLeftThumbButton,
|
||||
XboxRightThumbButton,
|
||||
|
||||
XboxA,
|
||||
XboxB,
|
||||
XboxX,
|
||||
XboxY,
|
||||
|
||||
XboxBlack,
|
||||
XboxWhite,
|
||||
|
||||
XboxLeftTrigger,
|
||||
XboxRightTrigger,
|
||||
};
|
||||
|
||||
enum N64Button
|
||||
{
|
||||
N64ThumbLeft,
|
||||
N64ThumbRight,
|
||||
N64ThumbUp,
|
||||
N64ThumbDown,
|
||||
|
||||
N64DPadLeft,
|
||||
N64DPadRight,
|
||||
N64DPadUp,
|
||||
N64DPadDown,
|
||||
|
||||
N64CButtonLeft,
|
||||
N64CButtonRight,
|
||||
N64CButtonUp,
|
||||
N64CButtonDown,
|
||||
|
||||
N64Start,
|
||||
|
||||
N64A,
|
||||
N64B,
|
||||
|
||||
N64ZTrigger,
|
||||
N64LeftTrigger,
|
||||
N64RightTrigger
|
||||
};
|
||||
|
||||
|
||||
enum SATURNButton
|
||||
{
|
||||
SATURNDPadLeft,
|
||||
SATURNDPadRight,
|
||||
SATURNDPadUp,
|
||||
SATURNDPadDown,
|
||||
|
||||
SATURNA,
|
||||
SATURNB,
|
||||
SATURNX,
|
||||
SATURNY,
|
||||
SATURNC,
|
||||
SATURNZ,
|
||||
|
||||
SATURNStart,
|
||||
|
||||
SATURNRightTrigger,
|
||||
SATURNLeftTrigger
|
||||
};
|
||||
|
||||
class Input
|
||||
{
|
||||
public:
|
||||
Input(void);
|
||||
~Input(void);
|
||||
|
||||
bool Create();
|
||||
void GetInput();
|
||||
|
||||
bool IsButtonPressed(XboxButton button);
|
||||
|
||||
byte IsLTriggerPressed();
|
||||
byte IsRTriggerPressed();
|
||||
|
||||
DWORD GetButtonDelay();
|
||||
void SetButtonDelay(DWORD milliseconds);
|
||||
|
||||
DWORD GetTriggerDelay();
|
||||
void SetTriggerDelay(DWORD milliseconds);
|
||||
|
||||
private:
|
||||
void RefreshDevices();
|
||||
|
||||
private:
|
||||
XINPUT_POLLING_PARAMETERS m_pollingParameters;
|
||||
XINPUT_STATE m_inputStates[4];
|
||||
XBGAMEPAD m_gamepads[4];
|
||||
|
||||
bool m_buttonPressed;
|
||||
DWORD m_buttonDelay;
|
||||
DWORD m_triggerDelay;
|
||||
DWORD m_lastTick;
|
||||
};
|
||||
|
||||
extern Input g_input;
|
||||
#endif
|
261
xbox1/RetroLaunch/IoSupport.cpp
Normal file
261
xbox1/RetroLaunch/IoSupport.cpp
Normal file
@ -0,0 +1,261 @@
|
||||
// IoSupport.cpp: implementation of the CIoSupport class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifdef _XBOX
|
||||
#include "iosupport.h"
|
||||
#include "undocumented.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define CTLCODE(DeviceType, Function, Method, Access) ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) )
|
||||
#define FSCTL_DISMOUNT_VOLUME CTLCODE( FILE_DEVICE_FILE_SYSTEM, 0x08, METHOD_BUFFERED, FILE_ANY_ACCESS )
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CIoSupport g_IOSupport;
|
||||
|
||||
CIoSupport::CIoSupport()
|
||||
{
|
||||
m_dwLastTrayState = 0;
|
||||
}
|
||||
|
||||
CIoSupport::~CIoSupport()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// szDrive e.g. "D:"
|
||||
// szDevice e.g. "Cdrom0" or "Harddisk0\Partition6"
|
||||
|
||||
HRESULT CIoSupport::Mount(CHAR* szDrive, CHAR* szDevice)
|
||||
{
|
||||
CHAR szSourceDevice[48];
|
||||
CHAR szDestinationDrive[16];
|
||||
|
||||
sprintf(szSourceDevice, "\\Device\\%s", szDevice);
|
||||
sprintf(szDestinationDrive, "\\??\\%s", szDrive);
|
||||
|
||||
STRING DeviceName =
|
||||
{
|
||||
strlen(szSourceDevice),
|
||||
strlen(szSourceDevice) + 1,
|
||||
szSourceDevice
|
||||
};
|
||||
|
||||
STRING LinkName =
|
||||
{
|
||||
strlen(szDestinationDrive),
|
||||
strlen(szDestinationDrive) + 1,
|
||||
szDestinationDrive
|
||||
};
|
||||
|
||||
IoCreateSymbolicLink(&LinkName, &DeviceName);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// szDrive e.g. "D:"
|
||||
|
||||
HRESULT CIoSupport::Unmount(CHAR* szDrive)
|
||||
{
|
||||
char szDestinationDrive[16];
|
||||
sprintf(szDestinationDrive, "\\??\\%s", szDrive);
|
||||
|
||||
STRING LinkName =
|
||||
{
|
||||
strlen(szDestinationDrive),
|
||||
strlen(szDestinationDrive) + 1,
|
||||
szDestinationDrive
|
||||
};
|
||||
|
||||
IoDeleteSymbolicLink(&LinkName);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HRESULT CIoSupport::Remount(CHAR* szDrive, CHAR* szDevice)
|
||||
{
|
||||
CHAR szSourceDevice[48];
|
||||
sprintf(szSourceDevice, "\\Device\\%s", szDevice);
|
||||
|
||||
Unmount(szDrive);
|
||||
|
||||
ANSI_STRING filename;
|
||||
OBJECT_ATTRIBUTES attributes;
|
||||
IO_STATUS_BLOCK status;
|
||||
HANDLE hDevice;
|
||||
NTSTATUS error;
|
||||
DWORD dummy;
|
||||
|
||||
RtlInitAnsiString(&filename, szSourceDevice);
|
||||
InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL);
|
||||
|
||||
if (!NT_SUCCESS(error = NtCreateFile(&hDevice, GENERIC_READ |
|
||||
SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN,
|
||||
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (!DeviceIoControl(hDevice, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dummy, NULL))
|
||||
{
|
||||
CloseHandle(hDevice);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
CloseHandle(hDevice);
|
||||
Mount(szDrive, szDevice);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CIoSupport::Remap(CHAR* szMapping)
|
||||
{
|
||||
char szMap[32];
|
||||
strcpy(szMap, szMapping );
|
||||
|
||||
char* pComma = strstr(szMap, ",");
|
||||
if (pComma)
|
||||
{
|
||||
*pComma = 0;
|
||||
|
||||
// map device to drive letter
|
||||
Unmount(szMap);
|
||||
Mount(szMap, &pComma[1]);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CIoSupport::EjectTray()
|
||||
{
|
||||
HalWriteSMBusValue(0x20, 0x0C, FALSE, 0); // eject tray
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CIoSupport::CloseTray()
|
||||
{
|
||||
HalWriteSMBusValue(0x20, 0x0C, FALSE, 1); // close tray
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DWORD CIoSupport::GetTrayState()
|
||||
{
|
||||
HalReadSMCTrayState(&m_dwTrayState, &m_dwTrayCount);
|
||||
|
||||
if(m_dwTrayState == TRAY_CLOSED_MEDIA_PRESENT)
|
||||
{
|
||||
if (m_dwLastTrayState != TRAY_CLOSED_MEDIA_PRESENT)
|
||||
{
|
||||
m_dwLastTrayState = m_dwTrayState;
|
||||
return DRIVE_CLOSED_MEDIA_PRESENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DRIVE_READY;
|
||||
}
|
||||
}
|
||||
else if(m_dwTrayState == TRAY_CLOSED_NO_MEDIA)
|
||||
{
|
||||
m_dwLastTrayState = m_dwTrayState;
|
||||
return DRIVE_CLOSED_NO_MEDIA;
|
||||
}
|
||||
else if(m_dwTrayState == TRAY_OPEN)
|
||||
{
|
||||
m_dwLastTrayState = m_dwTrayState;
|
||||
return DRIVE_OPEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dwLastTrayState = m_dwTrayState;
|
||||
}
|
||||
|
||||
return DRIVE_NOT_READY;
|
||||
}
|
||||
|
||||
HRESULT CIoSupport::Shutdown()
|
||||
{
|
||||
HalInitiateShutdown();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HANDLE CIoSupport::CreateFile()
|
||||
{
|
||||
ANSI_STRING filename;
|
||||
OBJECT_ATTRIBUTES attributes;
|
||||
IO_STATUS_BLOCK status;
|
||||
HANDLE hDevice;
|
||||
NTSTATUS error;
|
||||
|
||||
RtlInitAnsiString(&filename, "\\Device\\Cdrom0");
|
||||
InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL);
|
||||
|
||||
if (!NT_SUCCESS(error = NtCreateFile(&hDevice, GENERIC_READ |
|
||||
SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0,
|
||||
FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return hDevice;
|
||||
}
|
||||
|
||||
BOOL CIoSupport::GetFirstFile(CHAR* szFilename)
|
||||
{
|
||||
ANSI_STRING filename;
|
||||
OBJECT_ATTRIBUTES attributes;
|
||||
IO_STATUS_BLOCK status;
|
||||
HANDLE hDevice;
|
||||
NTSTATUS error;
|
||||
|
||||
RtlInitAnsiString(&filename, "\\Device\\Cdrom0");
|
||||
InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL);
|
||||
|
||||
if (!NT_SUCCESS(error = NtCreateFile(&hDevice, GENERIC_READ |
|
||||
SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0,
|
||||
FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT)))
|
||||
{
|
||||
OutputDebugString("Unable to open Cdrom0.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
CHAR* szBuffer = new CHAR[2048];
|
||||
DWORD dwRead = 0;
|
||||
|
||||
SetFilePointer(hDevice, 19 * 2048, NULL, FILE_BEGIN);
|
||||
if (!ReadFile(hDevice, szBuffer, 2048, &dwRead, NULL))
|
||||
{
|
||||
OutputDebugString("Unable to read ISO9660 root directory.\n");
|
||||
CloseHandle(hDevice);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CloseHandle(hDevice);
|
||||
szBuffer[2047] = 0;
|
||||
|
||||
int offset = 0;
|
||||
while (szBuffer[offset] == 0x22) offset += 0x22;
|
||||
offset += 33; // jump to start of filename
|
||||
|
||||
strcpy(szFilename, "#");
|
||||
strcat(szFilename, &szBuffer[offset]);
|
||||
|
||||
if (szBuffer)
|
||||
delete [] szBuffer;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
53
xbox1/RetroLaunch/IoSupport.h
Normal file
53
xbox1/RetroLaunch/IoSupport.h
Normal file
@ -0,0 +1,53 @@
|
||||
// IoSupport.h: interface for the CIoSupport class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_IOSUPPORT_H__F084A488_BD6E_49D5_8CD3_0BE62149DB40__INCLUDED_)
|
||||
#define AFX_IOSUPPORT_H__F084A488_BD6E_49D5_8CD3_0BE62149DB40__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#include "global.h"
|
||||
|
||||
#define TRAY_OPEN 16
|
||||
#define TRAY_CLOSED_NO_MEDIA 64
|
||||
#define TRAY_CLOSED_MEDIA_PRESENT 96
|
||||
|
||||
#define DRIVE_OPEN 0 // Open...
|
||||
#define DRIVE_NOT_READY 1 // Opening.. Closing...
|
||||
#define DRIVE_READY 2
|
||||
#define DRIVE_CLOSED_NO_MEDIA 3 // CLOSED...but no media in drive
|
||||
#define DRIVE_CLOSED_MEDIA_PRESENT 4 // Will be send once when the drive just have closed
|
||||
|
||||
class CIoSupport
|
||||
{
|
||||
public:
|
||||
CIoSupport();
|
||||
virtual ~CIoSupport();
|
||||
|
||||
HRESULT Mount(CHAR* szDrive, CHAR* szDevice);
|
||||
HRESULT Unmount(CHAR* szDrive);
|
||||
|
||||
HRESULT Remount(CHAR* szDrive, CHAR* szDevice);
|
||||
HRESULT Remap(CHAR* szMapping);
|
||||
|
||||
DWORD GetTrayState();
|
||||
HRESULT EjectTray();
|
||||
HRESULT CloseTray();
|
||||
HRESULT Shutdown();
|
||||
|
||||
HANDLE CreateFile();
|
||||
BOOL GetFirstFile(CHAR* szFilename);
|
||||
|
||||
private:
|
||||
DWORD m_dwTrayState;
|
||||
DWORD m_dwTrayCount;
|
||||
DWORD m_dwLastTrayState;
|
||||
};
|
||||
|
||||
extern CIoSupport g_IOSupport;
|
||||
#endif
|
||||
#endif // !defined(AFX_IOSUPPORT_H__F084A488_BD6E_49D5_8CD3_0BE62149DB40__INCLUDED_)
|
72
xbox1/RetroLaunch/Launcher.cpp
Normal file
72
xbox1/RetroLaunch/Launcher.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "Global.h"
|
||||
#include "Video.h"
|
||||
#include "IniFile.h"
|
||||
#include "IoSupport.h"
|
||||
#include "Input.h"
|
||||
#include "Debug.h"
|
||||
#include "Font.h"
|
||||
#include "MenuManager.h"
|
||||
#include "RomList.h"
|
||||
|
||||
bool g_bExit = false;
|
||||
|
||||
void __cdecl main()
|
||||
{
|
||||
g_debug.Print("Starting RetroLaunch\n");
|
||||
|
||||
// Set file cache size
|
||||
XSetFileCacheSize(8 * 1024 * 1024);
|
||||
|
||||
// Mount drives
|
||||
g_IOSupport.Mount("A:", "cdrom0");
|
||||
g_IOSupport.Mount("E:", "Harddisk0\\Partition1");
|
||||
g_IOSupport.Mount("Z:", "Harddisk0\\Partition2");
|
||||
g_IOSupport.Mount("F:", "Harddisk0\\Partition6");
|
||||
g_IOSupport.Mount("G:", "Harddisk0\\Partition7");
|
||||
|
||||
|
||||
// Initialize Direct3D
|
||||
if (!g_video.Create(NULL, false))
|
||||
return;
|
||||
|
||||
// Parse ini file for settings
|
||||
g_iniFile.CheckForIniEntry();
|
||||
|
||||
// Load the rom list if it isn't already loaded
|
||||
if (!g_romList.IsLoaded()) {
|
||||
g_romList.Load();
|
||||
}
|
||||
|
||||
// Init input here
|
||||
g_input.Create();
|
||||
|
||||
// Load the font here
|
||||
g_font.Create();
|
||||
|
||||
// Build menu here (Menu state -> Main Menu)
|
||||
g_menuManager.Create();
|
||||
|
||||
// Loop the app
|
||||
while (!g_bExit)
|
||||
{
|
||||
g_video.BeginRender();
|
||||
g_input.GetInput();
|
||||
g_menuManager.Update();
|
||||
g_video.EndRender();
|
||||
}
|
||||
}
|
241
xbox1/RetroLaunch/MenuMain.cpp
Normal file
241
xbox1/RetroLaunch/MenuMain.cpp
Normal file
@ -0,0 +1,241 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "MenuMain.h"
|
||||
#include "Debug.h"
|
||||
#include "Font.h"
|
||||
#include "RomList.h"
|
||||
#include "Input.h"
|
||||
|
||||
|
||||
CMenuMain g_menuMain;
|
||||
|
||||
CMenuMain::CMenuMain()
|
||||
{
|
||||
// we think that the rom list is unloaded until we know otherwise
|
||||
m_bRomListLoadedState = false;
|
||||
|
||||
ifstream stateFile;
|
||||
stateFile.open("T:\\RomlistState.dat");
|
||||
|
||||
if (stateFile.is_open())
|
||||
{
|
||||
int baseIndex;
|
||||
int romListMode;
|
||||
|
||||
stateFile >> baseIndex;
|
||||
stateFile >> romListMode;
|
||||
stateFile >> m_displayMode;
|
||||
|
||||
g_romList.SetRomListMode(romListMode);
|
||||
g_romList.m_iBaseIndex = baseIndex;
|
||||
|
||||
stateFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_displayMode = List;
|
||||
}
|
||||
}
|
||||
|
||||
CMenuMain::~CMenuMain()
|
||||
{
|
||||
ofstream stateFile;
|
||||
stateFile.open("T:\\RomlistState.dat");
|
||||
|
||||
stateFile << g_romList.GetBaseIndex() << endl;
|
||||
stateFile << g_romList.GetRomListMode() << endl;
|
||||
stateFile << m_displayMode << endl;
|
||||
|
||||
stateFile.close();
|
||||
}
|
||||
|
||||
bool CMenuMain::Create()
|
||||
{
|
||||
g_debug.Print("CMenuMain::Create()");
|
||||
|
||||
// Title coords with color
|
||||
m_menuMainTitle_x = 305;
|
||||
m_menuMainTitle_y = 30;
|
||||
m_menuMainTitle_c = 0xFFFFFFFF;
|
||||
|
||||
// Load background image
|
||||
m_menuMainBG.Create("Media\\menuMainBG.png");
|
||||
m_menuMainBG_x = 0;
|
||||
m_menuMainBG_y = 0;
|
||||
m_menuMainBG_w = 640;
|
||||
m_menuMainBG_h = 480;
|
||||
|
||||
// Init rom list coords
|
||||
m_menuMainRomListPos_x = 100;
|
||||
m_menuMainRomListPos_y = 100;
|
||||
m_menuMainRomListSpacing = 20;
|
||||
|
||||
// Load rom selector panel
|
||||
m_menuMainRomSelectPanel.Create("Media\\menuMainRomSelectPanel.png");
|
||||
m_menuMainRomSelectPanel_x = m_menuMainRomListPos_x - 5;
|
||||
m_menuMainRomSelectPanel_y = m_menuMainRomListPos_y - 2;
|
||||
m_menuMainRomSelectPanel_w = 440;
|
||||
m_menuMainRomSelectPanel_h = 20;
|
||||
|
||||
m_romListSelectedRom = 0;
|
||||
|
||||
//The first element in the romlist to render
|
||||
m_romListBeginRender = 0;
|
||||
|
||||
//The last element in the romlist to render
|
||||
m_romListEndRender = 18;
|
||||
|
||||
//The offset in the romlist
|
||||
m_romListOffset = 0;
|
||||
|
||||
if(m_romListEndRender > g_romList.GetRomListSize() - 1)
|
||||
{
|
||||
m_romListEndRender = g_romList.GetRomListSize() - 1;
|
||||
}
|
||||
|
||||
//Generate the rom list textures only once
|
||||
vector<Rom *>::iterator i;
|
||||
dword y = 0;
|
||||
for (i = g_romList.m_romList.begin(); i != g_romList.m_romList.end(); i++)
|
||||
{
|
||||
Rom *rom = *i;
|
||||
g_font.RenderToTexture(rom->GetTexture(), rom->GetFileName(), 18, XFONT_BOLD, 0xff808080, -1, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CMenuMain::Render()
|
||||
{
|
||||
//CheckRomListState();
|
||||
|
||||
//Render background image
|
||||
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
||||
|
||||
//Display some text
|
||||
//g_font.Render("Retro Arch", m_menuMainTitle_x, m_menuMainTitle_y, 20, XFONT_NORMAL, m_menuMainTitle_c);
|
||||
g_font.Render("Press RIGHT ANALOG STICK to exit. Press START to launch a rom.", 65, 450, 16, XFONT_NORMAL, m_menuMainTitle_c);
|
||||
|
||||
//Begin with the rom selector panel
|
||||
//FIXME: Width/Height needs to be current Rom texture width/height (or should we just leave it at a fixed size?)
|
||||
m_menuMainRomSelectPanel.Render(m_menuMainRomSelectPanel_x, m_menuMainRomSelectPanel_y, m_menuMainRomSelectPanel_w, m_menuMainRomSelectPanel_h);
|
||||
|
||||
dword dwSpacing = 0;
|
||||
|
||||
for (int i = m_romListBeginRender; i <= m_romListEndRender; i++)
|
||||
{
|
||||
g_romList.GetRomAt(i + m_romListOffset)->GetTexture().Render(m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing);
|
||||
dwSpacing += m_menuMainRomListSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CMenuMain::ProcessInput()
|
||||
{
|
||||
//FIXME: The calculations might be wrong :-/
|
||||
if(g_input.IsButtonPressed(XboxDPadDown) || g_input.IsButtonPressed(XboxLeftThumbDown) || g_input.IsRTriggerPressed())
|
||||
{
|
||||
|
||||
if(m_romListSelectedRom < g_romList.GetRomListSize())
|
||||
{
|
||||
|
||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom++;
|
||||
g_debug.Print("SELECTED ROM: "); g_debug.Print("%d", m_romListSelectedRom);
|
||||
}
|
||||
|
||||
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * (m_romListEndRender))))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom++;
|
||||
if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
|
||||
{
|
||||
m_romListSelectedRom = g_romList.GetRomListSize() - 1;
|
||||
}
|
||||
|
||||
|
||||
g_debug.Print("SELECTED ROM AFTER CORRECTION: "); g_debug.Print("%d", m_romListSelectedRom);
|
||||
|
||||
if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1) {
|
||||
m_romListOffset++;
|
||||
g_debug.Print("OFFSET: "); g_debug.Print("%d", m_romListOffset);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Go up and stop if less than 0 (item 0)
|
||||
if(g_input.IsButtonPressed(XboxDPadUp) || g_input.IsButtonPressed(XboxLeftThumbUp) || g_input.IsLTriggerPressed())
|
||||
{
|
||||
if(m_romListSelectedRom > -1)
|
||||
{
|
||||
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom--;
|
||||
g_debug.Print("SELECTED ROM: "); g_debug.Print("%d", m_romListSelectedRom);
|
||||
}
|
||||
|
||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom--;
|
||||
if(m_romListSelectedRom < 0)
|
||||
{
|
||||
m_romListSelectedRom = 0;
|
||||
}
|
||||
|
||||
|
||||
g_debug.Print("SELECTED ROM AFTER CORRECTION: "); g_debug.Print("%d", m_romListSelectedRom);
|
||||
|
||||
if(m_romListSelectedRom > 0 && m_romListOffset > 0) {
|
||||
m_romListOffset--;
|
||||
g_debug.Print("OFFSET: "); g_debug.Print("%d", m_romListOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Press A to launch, selected rom filename is saved into T:\\tmp.retro
|
||||
if(g_input.IsButtonPressed(XboxA))
|
||||
{
|
||||
//OutputDebugString(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str());
|
||||
//OutputDebugString("\n");
|
||||
g_iniFile.SaveTempRomFileName(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName());
|
||||
XLaunchNewImage("D:\\core.xbe", NULL);
|
||||
}
|
||||
|
||||
if (g_input.IsButtonPressed(XboxStart))
|
||||
{
|
||||
XLaunchNewImage("D:\\core.xbe", NULL);
|
||||
}
|
||||
|
||||
if (g_input.IsButtonPressed(XboxRightThumbButton))
|
||||
{
|
||||
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
|
||||
}
|
||||
}
|
||||
|
99
xbox1/RetroLaunch/MenuMain.h
Normal file
99
xbox1/RetroLaunch/MenuMain.h
Normal file
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#include "Surface.h"
|
||||
|
||||
enum DisplayMode
|
||||
{
|
||||
Box,
|
||||
List
|
||||
};
|
||||
|
||||
class CMenuMain
|
||||
{
|
||||
public:
|
||||
CMenuMain();
|
||||
~CMenuMain();
|
||||
|
||||
bool Create();
|
||||
|
||||
void Render();
|
||||
|
||||
void ProcessInput();
|
||||
|
||||
private:
|
||||
/*
|
||||
Texture,
|
||||
_x = xpos,
|
||||
_y = ypos,
|
||||
_w = width,
|
||||
_h = height,
|
||||
_c = color,
|
||||
*/
|
||||
|
||||
// Background image with coords
|
||||
CSurface m_menuMainBG;
|
||||
int m_menuMainBG_x;
|
||||
int m_menuMainBG_y;
|
||||
dword m_menuMainBG_w;
|
||||
dword m_menuMainBG_h;
|
||||
|
||||
// Rom selector panel with coords
|
||||
CSurface m_menuMainRomSelectPanel;
|
||||
int m_menuMainRomSelectPanel_x;
|
||||
int m_menuMainRomSelectPanel_y;
|
||||
dword m_menuMainRomSelectPanel_w;
|
||||
dword m_menuMainRomSelectPanel_h;
|
||||
|
||||
// Title coords with color
|
||||
int m_menuMainTitle_x;
|
||||
int m_menuMainTitle_y;
|
||||
dword m_menuMainTitle_c;
|
||||
|
||||
// Rom list coords
|
||||
int m_menuMainRomListPos_x;
|
||||
int m_menuMainRomListPos_y;
|
||||
int m_menuMainRomListSpacing;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Rom List menu buttons. The size can be variable so we use a list
|
||||
*/
|
||||
//list<MenuButton *> m_romListButtons;//list<Texture *>
|
||||
//no menu buttons, we will use plain textures
|
||||
list<CSurface *> m_romListButtons;
|
||||
|
||||
/**
|
||||
* The current mode the rom list is in
|
||||
*/
|
||||
int m_displayMode;
|
||||
|
||||
/**
|
||||
* The current loaded state the rom list is in
|
||||
*/
|
||||
bool m_bRomListLoadedState;
|
||||
|
||||
int m_romListBeginRender;
|
||||
int m_romListEndRender;
|
||||
int m_romListSelectedRom;
|
||||
int m_romListOffset;
|
||||
|
||||
};
|
||||
|
||||
extern CMenuMain g_menuMain;
|
98
xbox1/RetroLaunch/MenuManager.cpp
Normal file
98
xbox1/RetroLaunch/MenuManager.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "MenuManager.h"
|
||||
#include "MenuMain.h"
|
||||
#include "Debug.h"
|
||||
#include "Input.h"
|
||||
|
||||
|
||||
CMenuManager g_menuManager;
|
||||
|
||||
CMenuManager::CMenuManager()
|
||||
{
|
||||
}
|
||||
|
||||
CMenuManager::~CMenuManager()
|
||||
{
|
||||
}
|
||||
|
||||
bool CMenuManager::Create()
|
||||
{
|
||||
//Create the MenuManager, set to Main Menu
|
||||
g_debug.Print("Create MenuManager, set state to MENU_MAIN");
|
||||
SetMenuState(MENU_MAIN);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMenuManager::SetMenuState(int nMenuID)
|
||||
{
|
||||
m_pMenuID = nMenuID;
|
||||
|
||||
switch (m_pMenuID) {
|
||||
case MENU_MAIN:
|
||||
//Create the Main Menu
|
||||
g_menuMain.Create();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMenuManager::Update()
|
||||
{
|
||||
//Process overall input
|
||||
ProcessInput();
|
||||
|
||||
switch (m_pMenuID) {
|
||||
case MENU_MAIN:
|
||||
|
||||
// Process menu specific input
|
||||
g_menuMain.ProcessInput();
|
||||
|
||||
// Render the Main Menu
|
||||
g_menuMain.Render();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CMenuManager::ProcessInput()
|
||||
{
|
||||
//ADD: ProcessTarget -> switch to another menu
|
||||
|
||||
//Return to Dashboard
|
||||
if(g_input.IsLTriggerPressed() &&
|
||||
g_input.IsRTriggerPressed() &&
|
||||
g_input.IsButtonPressed(XboxBlack) &&
|
||||
g_input.IsButtonPressed(XboxWhite) &&
|
||||
g_input.IsButtonPressed(XboxBack) &&
|
||||
g_input.IsButtonPressed(XboxStart))
|
||||
{
|
||||
|
||||
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CMenuManager::GetMenuState()
|
||||
{
|
||||
return m_pMenuID;
|
||||
}
|
||||
|
50
xbox1/RetroLaunch/MenuManager.h
Normal file
50
xbox1/RetroLaunch/MenuManager.h
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
enum eMenuState
|
||||
{
|
||||
MENU_MAIN = 0,
|
||||
MENU_SETTINGS_SELECT,
|
||||
MENU_SETTINGS_EMU,
|
||||
MENU_SETTINGS_AUDIO,
|
||||
MENU_SETTINGS_SKIN,
|
||||
MENU_LAUNCHER
|
||||
};
|
||||
|
||||
|
||||
class CMenuManager
|
||||
{
|
||||
public:
|
||||
CMenuManager();
|
||||
~CMenuManager();
|
||||
|
||||
bool Create();
|
||||
bool SetMenuState(int nMenuID);
|
||||
int GetMenuState();
|
||||
bool Destroy();
|
||||
void Update();
|
||||
void ProcessInput();
|
||||
|
||||
|
||||
private:
|
||||
int m_pMenuID;
|
||||
|
||||
};
|
||||
|
||||
extern CMenuManager g_menuManager;
|
33
xbox1/RetroLaunch/RetroLaunch.sln
Normal file
33
xbox1/RetroLaunch/RetroLaunch.sln
Normal file
@ -0,0 +1,33 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RetroLaunch", "RetroLaunch.vcproj", "{14134C4E-7FD3-46F0-AD16-C32D952978EA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Profile = Profile
|
||||
Profile_FastCap = Profile_FastCap
|
||||
Release = Release
|
||||
Release_LTCG = Release_LTCG
|
||||
ReleaseTest = ReleaseTest
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Debug.ActiveCfg = Debug|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Debug.Build.0 = Debug|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Profile.ActiveCfg = Profile|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Profile.Build.0 = Profile|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Profile_FastCap.ActiveCfg = Profile_FastCap|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Profile_FastCap.Build.0 = Profile_FastCap|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Release.ActiveCfg = Release|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Release.Build.0 = Release|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Release_LTCG.ActiveCfg = Release_LTCG|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.Release_LTCG.Build.0 = Release_LTCG|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.ReleaseTest.ActiveCfg = ReleaseTest|Xbox
|
||||
{14134C4E-7FD3-46F0-AD16-C32D952978EA}.ReleaseTest.Build.0 = ReleaseTest|Xbox
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
447
xbox1/RetroLaunch/RetroLaunch.vcproj
Normal file
447
xbox1/RetroLaunch/RetroLaunch.vcproj
Normal file
@ -0,0 +1,447 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="RetroLaunch"
|
||||
ProjectGUID="{14134C4E-7FD3-46F0-AD16-C32D952978EA}"
|
||||
RootNamespace="Launcher CE"
|
||||
Keyword="XboxProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Xbox"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Xbox"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
OptimizeForProcessor="2"
|
||||
PreprocessorDefinitions="_DEBUG;_XBOX"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="2"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xactengd.lib xsndtrkd.lib xvoiced.lib xonlined.lib xboxkrnl.lib xbdm.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
GenerateMapFile="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeForWindows98="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="XboxDeploymentTool"
|
||||
RemotePath="xe:\RetroArch-Xbox1\default.xbe"
|
||||
AdditionalFiles="media=dist\media"/>
|
||||
<Tool
|
||||
Name="XboxImageTool"
|
||||
FileName="$(TargetDir)default.xbe"
|
||||
StackSize="65536"
|
||||
IncludeDebugInfo="TRUE"
|
||||
NoLibWarn="TRUE"
|
||||
UDCluster="3"
|
||||
TitleID="0x2481632A"
|
||||
TitleName="RetroArch"
|
||||
TitleImage="titleimage.jpg"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Profile|Xbox"
|
||||
OutputDirectory="Profile"
|
||||
IntermediateDirectory="Profile"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="xapilib.lib d3d8i.lib d3dx8.lib xgraphics.lib dsound.lib dmusici.lib xactengi.lib xsndtrk.lib xvoice.lib xonlines.lib xboxkrnl.lib xbdm.lib xperf.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
SetChecksum="TRUE"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="XboxDeploymentTool"
|
||||
RemotePath="xe:\RetroArch-Xbox1\default.xbe"
|
||||
AdditionalFiles="media=dist\media"/>
|
||||
<Tool
|
||||
Name="XboxImageTool"
|
||||
StackSize="65536"
|
||||
IncludeDebugInfo="TRUE"
|
||||
NoLibWarn="TRUE"
|
||||
TitleID="0x2481632A"
|
||||
TitleName="RetroArch"
|
||||
TitleImage="titleimage.jpg"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Profile_FastCap|Xbox"
|
||||
OutputDirectory="Profile_FastCap"
|
||||
IntermediateDirectory="Profile_FastCap"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"
|
||||
FastCAP="TRUE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="xapilib.lib d3d8i.lib d3dx8.lib xgraphics.lib dsound.lib dmusici.lib xactengi.lib xsndtrk.lib xvoice.lib xonlines.lib xboxkrnl.lib xbdm.lib xperf.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
SetChecksum="TRUE"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="XboxDeploymentTool"
|
||||
RemotePath="xe:\RetroArch-Xbox1\default.xbe"
|
||||
AdditionalFiles="media=dist\media"/>
|
||||
<Tool
|
||||
Name="XboxImageTool"
|
||||
StackSize="65536"
|
||||
IncludeDebugInfo="TRUE"
|
||||
NoLibWarn="TRUE"
|
||||
TitleID="0x2481632A"
|
||||
TitleName="RetroArch"
|
||||
TitleImage="titleimage.jpg"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Xbox"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xacteng.lib xsndtrk.lib xvoice.lib xonlines.lib xboxkrnl.lib"
|
||||
OutputFile="$(OutDir)/default.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/default.pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
SetChecksum="TRUE"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="XboxDeploymentTool"
|
||||
RemotePath="xe:\RetroArch-Xbox1\default.xbe"
|
||||
AdditionalFiles="media=dist\media"/>
|
||||
<Tool
|
||||
Name="XboxImageTool"
|
||||
FileName="..\bin\default.xbe"
|
||||
StackSize="65536"
|
||||
TitleID="0x2481632A"
|
||||
TitleName="RetroArch"
|
||||
TitleImage="titleimage.jpg"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_LTCG|Xbox"
|
||||
OutputDirectory="Release_LTCG"
|
||||
IntermediateDirectory="Release_LTCG"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="xapilib.lib d3d8ltcg.lib d3dx8.lib xgraphicsltcg.lib dsound.lib dmusicltcg.lib xactengltcg.lib xsndtrk.lib xvoice.lib xonlines.lib xboxkrnl.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
SetChecksum="TRUE"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="XboxDeploymentTool"
|
||||
RemotePath="xe:\RetroArch-Xbox1\default.xbe"
|
||||
AdditionalFiles="media=dist\media"/>
|
||||
<Tool
|
||||
Name="XboxImageTool"
|
||||
StackSize="65536"
|
||||
TitleID="0x2481632A"
|
||||
TitleName="RetroArch"
|
||||
TitleImage="titleimage.jpg"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="ReleaseTest|Xbox"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="TRUE"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xacteng.lib xsndtrk.lib xvoice.lib xonlines.lib xboxkrnl.lib"
|
||||
OutputFile="$(OutDir)/$(ProjectName).exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
OptimizeForWindows98="1"
|
||||
SetChecksum="TRUE"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="XboxDeploymentTool"
|
||||
RemotePath="xe:\RetroArch-Xbox1\default.xbe"
|
||||
AdditionalFiles="media=dist\media"/>
|
||||
<Tool
|
||||
Name="XboxImageTool"
|
||||
FileName="$(TargetDir)default.xbe"
|
||||
StackSize="65536"
|
||||
TitleID="0x2481632A"
|
||||
TitleName="RetroArch"
|
||||
TitleImage="titleimage.jpg"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Graphics"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\Font.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Font.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Surface.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Surface.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Video.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Video.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="System"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\Debug.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Debug.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Global.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IoSupport.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IoSupport.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SimpleIni.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Undocumented.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Launcher"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\IniFile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\IniFile.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Launcher.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Rom.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Rom.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RomList.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RomList.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Input"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\Input.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Input.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Menu"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\MenuMain.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MenuMain.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MenuManager.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MenuManager.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
76
xbox1/RetroLaunch/Rom.cpp
Normal file
76
xbox1/RetroLaunch/Rom.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Surreal 64 Launcher (C) 2003
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||
*/
|
||||
|
||||
#include "Rom.h"
|
||||
//#include "BoxArtTable.h"
|
||||
|
||||
Rom::Rom()
|
||||
{
|
||||
m_bLoaded = false;
|
||||
}
|
||||
|
||||
Rom::~Rom(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool Rom::Load(const string &szFilename)
|
||||
{
|
||||
if (m_bLoaded)
|
||||
return true;
|
||||
|
||||
m_szFilename = szFilename;
|
||||
|
||||
// get the filename for the box art image
|
||||
//FIXME: Add BoxArtTable.cpp/h, open iso file, grab header, extract ID ie. T-6003G, use for boxartfilename
|
||||
{
|
||||
m_szBoxArtFilename = "D:\\boxart\\default.jpg"; //g_boxArtTable.GetBoxArtFilename(m_dwCrc1);
|
||||
}
|
||||
|
||||
m_bLoaded = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rom::LoadFromCache(const string &szFilename, const string &szBoxArtFilename)
|
||||
{
|
||||
m_szFilename = szFilename;
|
||||
m_szBoxArtFilename = szBoxArtFilename;
|
||||
|
||||
m_bLoaded = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
string Rom::GetFileName()
|
||||
{
|
||||
return m_szFilename;
|
||||
}
|
||||
|
||||
string Rom::GetBoxArtFilename()
|
||||
{
|
||||
return m_szBoxArtFilename;
|
||||
}
|
||||
|
||||
string Rom::GetComments()
|
||||
{
|
||||
//return string(m_iniEntry->szComments);
|
||||
return "blah";
|
||||
}
|
||||
|
||||
|
||||
CSurface &Rom::GetTexture()
|
||||
{
|
||||
return m_texture;
|
||||
}
|
44
xbox1/RetroLaunch/Rom.h
Normal file
44
xbox1/RetroLaunch/Rom.h
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Surreal 64 Launcher (C) 2003
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
#include "IniFile.h"
|
||||
#include "Surface.h"
|
||||
|
||||
class Rom
|
||||
{
|
||||
public:
|
||||
Rom();
|
||||
~Rom();
|
||||
|
||||
bool Load(const string &szFilename);
|
||||
bool LoadFromCache(const string &szFilename, const string &szBoxArtFilename);
|
||||
|
||||
string GetFileName();
|
||||
string GetBoxArtFilename();
|
||||
string GetComments();
|
||||
|
||||
CSurface &GetTexture();
|
||||
|
||||
private:
|
||||
string m_szFilename;
|
||||
string m_szBoxArtFilename;
|
||||
|
||||
bool m_bLoaded;
|
||||
|
||||
CSurface m_texture;
|
||||
};
|
309
xbox1/RetroLaunch/RomList.cpp
Normal file
309
xbox1/RetroLaunch/RomList.cpp
Normal file
@ -0,0 +1,309 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "RomList.h"
|
||||
|
||||
RomList g_romList;
|
||||
|
||||
bool RLessThan(Rom *elem1, Rom *elem2)
|
||||
{
|
||||
return (elem1->GetFileName() < elem2->GetFileName());
|
||||
}
|
||||
|
||||
RomList::RomList(void)
|
||||
{
|
||||
m_romListMode = All;
|
||||
m_iBaseIndex = 0;
|
||||
m_bLoaded = false;
|
||||
m_szRomPath = "D:\\Roms\\";
|
||||
}
|
||||
|
||||
RomList::~RomList(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void RomList::Load()
|
||||
{
|
||||
ifstream cacheFile;
|
||||
|
||||
cacheFile.open("T:\\RomlistCache.dat");
|
||||
|
||||
// try and open the cache file, if it doesnt exist, generate the rom list
|
||||
if (!cacheFile.is_open())
|
||||
{
|
||||
Build();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!cacheFile.eof())
|
||||
{
|
||||
string szFilename;
|
||||
string szBoxArtFilename;
|
||||
|
||||
getline(cacheFile, szFilename);
|
||||
getline(cacheFile, szBoxArtFilename);
|
||||
|
||||
Rom *rom = new Rom();
|
||||
|
||||
bool bSuccess = rom->LoadFromCache(szFilename, szBoxArtFilename);
|
||||
|
||||
if (bSuccess)
|
||||
m_romList.push_back(rom);
|
||||
else
|
||||
delete rom;
|
||||
}
|
||||
|
||||
cacheFile.close();
|
||||
}
|
||||
|
||||
m_bLoaded = true;
|
||||
}
|
||||
|
||||
void RomList::Save()
|
||||
{
|
||||
vector<Rom *>::iterator i;
|
||||
ofstream cacheFile;
|
||||
|
||||
// open/overwrite the rom cache
|
||||
cacheFile.open("T:\\RomlistCache.dat");
|
||||
|
||||
for (i = m_romList.begin(); i != m_romList.end(); i++)
|
||||
{
|
||||
Rom *rom = *i;
|
||||
|
||||
cacheFile << rom->GetFileName() << endl;
|
||||
cacheFile << rom->GetBoxArtFilename() << endl;
|
||||
}
|
||||
|
||||
cacheFile.close();
|
||||
}
|
||||
|
||||
void RomList::Refresh()
|
||||
{
|
||||
Destroy();
|
||||
DeleteFile("T:\\RomlistCache.dat");
|
||||
DeleteFile("T:\\RomlistState.dat");
|
||||
}
|
||||
|
||||
bool RomList::IsLoaded()
|
||||
{
|
||||
return m_bLoaded;
|
||||
}
|
||||
|
||||
void RomList::SetRomListMode(int mode)
|
||||
{
|
||||
m_iBaseIndex = 0;
|
||||
m_romListMode = mode;
|
||||
}
|
||||
|
||||
int RomList::GetRomListMode()
|
||||
{
|
||||
return m_romListMode;
|
||||
}
|
||||
|
||||
void RomList::AddRomToList(Rom *rom, int mode)
|
||||
{
|
||||
vector<Rom *> *pList;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case All:
|
||||
pList = &m_romList;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// look to see if the rom is already in the list, we dont want duplicates
|
||||
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
||||
{
|
||||
if (rom == (*pList)[i])
|
||||
return;
|
||||
}
|
||||
|
||||
pList->push_back(rom);
|
||||
sort(pList->begin(), pList->end(), RLessThan);
|
||||
}
|
||||
|
||||
void RomList::RemoveRomFromList(Rom *rom, int mode)
|
||||
{
|
||||
vector<Rom *> *pList;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case All:
|
||||
pList = &m_romList;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
vector<Rom *>::iterator i;
|
||||
|
||||
// look to see if the rom is already in the list, we dont want duplicates
|
||||
for (i = pList->begin(); i != pList->end(); i++)
|
||||
{
|
||||
if (rom == *i)
|
||||
{
|
||||
pList->erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int RomList::GetBaseIndex()
|
||||
{
|
||||
if (m_iBaseIndex > GetRomListSize() - 1)
|
||||
m_iBaseIndex = GetRomListSize() - 1;
|
||||
if (m_iBaseIndex < 0)
|
||||
m_iBaseIndex = 0;
|
||||
|
||||
return m_iBaseIndex;
|
||||
}
|
||||
|
||||
void RomList::SetBaseIndex(int index)
|
||||
{
|
||||
if (index > GetRomListSize() - 1)
|
||||
index = GetRomListSize() - 1;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
|
||||
m_iBaseIndex = index;
|
||||
}
|
||||
|
||||
int RomList::GetRomListSize()
|
||||
{
|
||||
switch (m_romListMode)
|
||||
{
|
||||
case All:
|
||||
return m_romList.size();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Rom *RomList::GetRomAt(int index)
|
||||
{
|
||||
switch (m_romListMode)
|
||||
{
|
||||
case All:
|
||||
return m_romList[index];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RomList::FindRom(Rom *rom, int mode)
|
||||
{
|
||||
vector<Rom *> *pList;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case All:
|
||||
pList = &m_romList;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
||||
{
|
||||
if (rom == (*pList)[i])
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void RomList::CleanUpTextures()
|
||||
{
|
||||
if (!IsLoaded())
|
||||
return;
|
||||
|
||||
// keep the 25 textures above and below the base index
|
||||
for (int i = 0; i < m_iBaseIndex - 25; i++)
|
||||
{
|
||||
m_romList[i]->GetTexture().Destroy();
|
||||
}
|
||||
|
||||
for (int i = m_iBaseIndex + 25; i < GetRomListSize(); i++)
|
||||
{
|
||||
m_romList[i]->GetTexture().Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void RomList::DestroyAllTextures()
|
||||
{
|
||||
vector<Rom *>::iterator i;
|
||||
|
||||
for (i = m_romList.begin(); i != m_romList.end(); i++)
|
||||
{
|
||||
Rom *rom = *i;
|
||||
rom->GetTexture().Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void RomList::Build()
|
||||
{
|
||||
WIN32_FIND_DATA fd;
|
||||
|
||||
HANDLE hFF = FindFirstFile((m_szRomPath + "*.*").c_str(), &fd);
|
||||
|
||||
do
|
||||
{
|
||||
char ext[_MAX_EXT];
|
||||
|
||||
// get the filename extension
|
||||
_splitpath((m_szRomPath + fd.cFileName).c_str(),
|
||||
NULL, NULL, NULL, ext);
|
||||
|
||||
if (
|
||||
stricmp(ext, ".bin") == 0
|
||||
|| stricmp(ext, ".cue") == 0
|
||||
|| stricmp(ext, ".iso") == 0
|
||||
|| stricmp(ext, ".mdf") == 0
|
||||
|| stricmp(ext, ".gba") == 0
|
||||
)
|
||||
{
|
||||
Rom *rom = new Rom();
|
||||
bool bSuccess = rom->Load((m_szRomPath + fd.cFileName).c_str());
|
||||
|
||||
if (bSuccess)
|
||||
m_romList.push_back(rom);
|
||||
else
|
||||
delete rom;
|
||||
}
|
||||
} while (FindNextFile(hFF, &fd));
|
||||
|
||||
sort(m_romList.begin(), m_romList.end(), RLessThan);
|
||||
|
||||
m_bLoaded = true;
|
||||
}
|
||||
|
||||
void RomList::Destroy()
|
||||
{
|
||||
m_bLoaded = false;
|
||||
m_iBaseIndex = 0;
|
||||
|
||||
vector<Rom *>::iterator i;
|
||||
|
||||
for (i = m_romList.begin(); i != m_romList.end(); i++)
|
||||
{
|
||||
delete *i;
|
||||
}
|
||||
|
||||
m_romList.clear();
|
||||
}
|
72
xbox1/RetroLaunch/RomList.h
Normal file
72
xbox1/RetroLaunch/RomList.h
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
#include "Rom.h"
|
||||
|
||||
enum RomListMode
|
||||
{
|
||||
All
|
||||
};
|
||||
|
||||
class RomList
|
||||
{
|
||||
public:
|
||||
RomList(void);
|
||||
virtual ~RomList(void);
|
||||
|
||||
void Load();
|
||||
void Save();
|
||||
void Refresh();
|
||||
|
||||
bool IsLoaded();
|
||||
|
||||
void SetRomListMode(int mode);
|
||||
int GetRomListMode();
|
||||
|
||||
void AddRomToList(Rom *rom, int mode);
|
||||
void RemoveRomFromList(Rom *rom, int mode);
|
||||
|
||||
int GetBaseIndex();
|
||||
void SetBaseIndex(int index);
|
||||
|
||||
int GetRomListSize();
|
||||
|
||||
Rom *GetRomAt(int index);
|
||||
int FindRom(Rom *rom, int mode);
|
||||
|
||||
void CleanUpTextures();
|
||||
void DestroyAllTextures();
|
||||
|
||||
int m_iBaseIndex;
|
||||
|
||||
vector<Rom *> m_romList;
|
||||
|
||||
private:
|
||||
void Build();
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
|
||||
bool m_bLoaded;
|
||||
|
||||
int m_romListMode;
|
||||
|
||||
string m_szRomPath;
|
||||
};
|
||||
|
||||
extern RomList g_romList;
|
3262
xbox1/RetroLaunch/SimpleIni.h
Normal file
3262
xbox1/RetroLaunch/SimpleIni.h
Normal file
File diff suppressed because it is too large
Load Diff
255
xbox1/RetroLaunch/Surface.cpp
Normal file
255
xbox1/RetroLaunch/Surface.cpp
Normal file
@ -0,0 +1,255 @@
|
||||
/**
|
||||
* Surreal 64 Launcher (C) 2003
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||
*
|
||||
* Additional code and cleanups: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#include "Surface.h"
|
||||
#include "Debug.h"
|
||||
|
||||
CSurface::CSurface()
|
||||
{
|
||||
m_pTexture = NULL;
|
||||
m_pVertexBuffer = NULL;
|
||||
m_byOpacity = 255;
|
||||
m_byR = 255;
|
||||
m_byG = 255;
|
||||
m_byB = 255;
|
||||
m_bLoaded = false;
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
}
|
||||
|
||||
CSurface::CSurface(const string &szFilename)
|
||||
{
|
||||
CSurface();
|
||||
Create(szFilename);
|
||||
}
|
||||
|
||||
CSurface::~CSurface()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool CSurface::Create(const string &szFilename)
|
||||
{
|
||||
if (m_bLoaded)
|
||||
Destroy();
|
||||
|
||||
g_hResult = D3DXCreateTextureFromFileExA(g_video.m_pD3DDevice, // d3d device
|
||||
("D:\\" + szFilename).c_str(), // filename
|
||||
D3DX_DEFAULT, D3DX_DEFAULT, // width/height
|
||||
D3DX_DEFAULT, // mipmaps
|
||||
0, // usage
|
||||
D3DFMT_A8R8G8B8, // format
|
||||
D3DPOOL_MANAGED, // memory class
|
||||
D3DX_DEFAULT, // texture filter
|
||||
D3DX_DEFAULT, // mipmapping
|
||||
0, // colorkey
|
||||
&m_imageInfo, // image info
|
||||
NULL, // pallete
|
||||
&m_pTexture); // texture
|
||||
|
||||
if (FAILED(g_hResult))
|
||||
{
|
||||
g_debug.Print("Failed: D3DXCreateTextureFromFileExA()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// create a vertex buffer for the quad that will display the texture
|
||||
g_hResult = g_video.m_pD3DDevice->CreateVertexBuffer(4 * sizeof(CustomVertex),
|
||||
D3DUSAGE_WRITEONLY,
|
||||
D3DFVF_CUSTOMVERTEX,
|
||||
D3DPOOL_MANAGED, &m_pVertexBuffer);
|
||||
if (FAILED(g_hResult))
|
||||
{
|
||||
g_debug.Print("Failed: CreateVertexBuffer()\n");
|
||||
m_pTexture->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bLoaded = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSurface::Create(dword width, dword height)
|
||||
{
|
||||
if (m_bLoaded)
|
||||
Destroy();
|
||||
|
||||
g_hResult = g_video.m_pD3DDevice->CreateTexture(width, height, 1, 0,
|
||||
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
|
||||
&m_pTexture);
|
||||
|
||||
if (FAILED(g_hResult))
|
||||
{
|
||||
g_debug.Print("Failed: CreateTexture()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_imageInfo.Width = width;
|
||||
m_imageInfo.Height = height;
|
||||
m_imageInfo.Format = D3DFMT_A8R8G8B8;
|
||||
|
||||
// create a vertex buffer for the quad that will display the texture
|
||||
g_hResult = g_video.m_pD3DDevice->CreateVertexBuffer(4 * sizeof(CustomVertex),
|
||||
D3DUSAGE_WRITEONLY,
|
||||
D3DFVF_CUSTOMVERTEX,
|
||||
D3DPOOL_MANAGED, &m_pVertexBuffer);
|
||||
if (FAILED(g_hResult))
|
||||
{
|
||||
g_debug.Print("Failed: CreateVertexBuffer()\n");
|
||||
m_pTexture->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bLoaded = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSurface::Destroy()
|
||||
{
|
||||
// free the vertex buffer
|
||||
if (m_pVertexBuffer)
|
||||
{
|
||||
m_pVertexBuffer->Release();
|
||||
m_pVertexBuffer = NULL;
|
||||
}
|
||||
|
||||
// free the texture
|
||||
if (m_pTexture)
|
||||
{
|
||||
m_pTexture->Release();
|
||||
m_pTexture = NULL;
|
||||
}
|
||||
|
||||
m_bLoaded = false;
|
||||
}
|
||||
|
||||
bool CSurface::IsLoaded()
|
||||
{
|
||||
return m_bLoaded;
|
||||
}
|
||||
|
||||
bool CSurface::Render()
|
||||
{
|
||||
return Render(m_x, m_y);
|
||||
}
|
||||
|
||||
bool CSurface::Render(int x, int y)
|
||||
{
|
||||
return Render(x, y, m_imageInfo.Width, m_imageInfo.Height);
|
||||
}
|
||||
|
||||
bool CSurface::Render(int x, int y, dword w, dword h)
|
||||
{
|
||||
if (m_pTexture == NULL || m_pVertexBuffer == NULL || m_bLoaded == false)
|
||||
return false;
|
||||
|
||||
float fX = static_cast<float>(x);
|
||||
float fY = static_cast<float>(y);
|
||||
|
||||
// create the new vertices
|
||||
CustomVertex newVerts[] =
|
||||
{
|
||||
// x, y, z, color, u ,v
|
||||
{fX, fY, 0.0f, D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB), 0, 0},
|
||||
{fX + w, fY, 0.0f, D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB), 1, 0},
|
||||
{fX + w, fY + h, 0.0f, D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB), 1, 1},
|
||||
{fX, fY + h, 0.0f, D3DCOLOR_ARGB(m_byOpacity, m_byR, m_byG, m_byB), 0, 1}
|
||||
};
|
||||
|
||||
// load the existing vertices
|
||||
CustomVertex *pCurVerts;
|
||||
|
||||
g_hResult = m_pVertexBuffer->Lock(0, 0, (byte **)&pCurVerts, 0);
|
||||
|
||||
if (FAILED(g_hResult))
|
||||
{
|
||||
g_debug.Print("Failed: m_pVertexBuffer->Lock()\n");
|
||||
return false;
|
||||
}
|
||||
// copy the new verts over the old verts
|
||||
memcpy(pCurVerts, newVerts, 4 * sizeof(CustomVertex));
|
||||
|
||||
m_pVertexBuffer->Unlock();
|
||||
|
||||
|
||||
g_video.m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
g_video.m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
g_video.m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||
|
||||
// also blend the texture with the set alpha value
|
||||
g_video.m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
g_video.m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||||
g_video.m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||||
|
||||
// draw the quad
|
||||
g_video.m_pD3DDevice->SetTexture(0, m_pTexture);
|
||||
g_video.m_pD3DDevice->SetStreamSource(0, m_pVertexBuffer, sizeof(CustomVertex));
|
||||
g_video.m_pD3DDevice->SetVertexShader(D3DFVF_CUSTOMVERTEX);
|
||||
#ifdef _XBOX
|
||||
g_video.m_pD3DDevice->DrawPrimitive(D3DPT_QUADLIST, 0, 1);
|
||||
#else
|
||||
//FIXME: vertices order !
|
||||
g_video.m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSurface::SetOpacity(byte opacity)
|
||||
{
|
||||
m_byOpacity = opacity;
|
||||
}
|
||||
|
||||
void CSurface::SetTint(byte r, byte g, byte b)
|
||||
{
|
||||
m_byR = r;
|
||||
m_byG = g;
|
||||
m_byB = b;
|
||||
}
|
||||
|
||||
void CSurface::MoveTo(int x, int y)
|
||||
{
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
}
|
||||
|
||||
dword CSurface::GetWidth()
|
||||
{
|
||||
if (m_pTexture == NULL || m_pVertexBuffer == NULL)
|
||||
return 0;
|
||||
|
||||
return m_imageInfo.Width;
|
||||
}
|
||||
|
||||
dword CSurface::GetHeight()
|
||||
{
|
||||
if (m_pTexture == NULL || m_pVertexBuffer == NULL)
|
||||
return 0;
|
||||
|
||||
return m_imageInfo.Height;
|
||||
}
|
||||
|
||||
byte CSurface::GetOpacity()
|
||||
{
|
||||
return m_byOpacity;
|
||||
}
|
||||
|
||||
IDirect3DTexture8 *CSurface::GetTexture()
|
||||
{
|
||||
return m_pTexture;
|
||||
}
|
90
xbox1/RetroLaunch/Surface.h
Normal file
90
xbox1/RetroLaunch/Surface.h
Normal file
@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Surreal 64 Launcher (C) 2003
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: email: buttza@hotmail.com, lantus@lantus-x.com
|
||||
*
|
||||
* Additional code and cleanups: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
#include "Video.h"
|
||||
|
||||
class CSurface
|
||||
{
|
||||
public:
|
||||
CSurface();
|
||||
CSurface(const string &szFilename);
|
||||
~CSurface();
|
||||
|
||||
/**
|
||||
* Do functions
|
||||
*/
|
||||
bool Create(const string &szFilename);
|
||||
bool Create(dword width, dword height);
|
||||
void Destroy();
|
||||
|
||||
bool IsLoaded();
|
||||
|
||||
bool Render();
|
||||
bool Render(int x, int y);
|
||||
bool Render(int x, int y, dword w, dword h);
|
||||
|
||||
/**
|
||||
* Set functions
|
||||
*/
|
||||
void SetOpacity(byte opacity);
|
||||
void SetTint(byte r, byte g, byte b);
|
||||
|
||||
void MoveTo(int x, int y);
|
||||
|
||||
/**
|
||||
* Get functions
|
||||
*/
|
||||
dword GetWidth();
|
||||
dword GetHeight();
|
||||
|
||||
byte GetOpacity();
|
||||
|
||||
IDirect3DTexture8 *GetTexture();
|
||||
|
||||
private:
|
||||
/**
|
||||
* A d3d texture object that will contain the loaded texture
|
||||
* and a d3d vertex buffer object that will contain the vertex
|
||||
* buffer for the quad which will display the texture
|
||||
*/
|
||||
IDirect3DTexture8 *m_pTexture;
|
||||
IDirect3DVertexBuffer8 *m_pVertexBuffer;
|
||||
|
||||
/**
|
||||
* The default render position of the texture
|
||||
*/
|
||||
int m_x, m_y;
|
||||
|
||||
/**
|
||||
* The width and height of the texture
|
||||
*/
|
||||
D3DXIMAGE_INFO m_imageInfo;
|
||||
|
||||
/**
|
||||
* The opacity of the texture
|
||||
*/
|
||||
byte m_byOpacity;
|
||||
byte m_byR, m_byG, m_byB;
|
||||
|
||||
/**
|
||||
* Whether the texture has been created or not
|
||||
*/
|
||||
bool m_bLoaded;
|
||||
};
|
1373
xbox1/RetroLaunch/Undocumented.h
Normal file
1373
xbox1/RetroLaunch/Undocumented.h
Normal file
File diff suppressed because it is too large
Load Diff
138
xbox1/RetroLaunch/Video.cpp
Normal file
138
xbox1/RetroLaunch/Video.cpp
Normal file
@ -0,0 +1,138 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
|
||||
#include "Video.h"
|
||||
#include "IniFile.h"
|
||||
#include "Debug.h"
|
||||
|
||||
CVideo g_video;
|
||||
HRESULT g_hResult;
|
||||
|
||||
CVideo::CVideo(void)
|
||||
{
|
||||
}
|
||||
|
||||
CVideo::~CVideo(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool CVideo::Create(HWND hDeviceWindow, bool bWindowed)
|
||||
{
|
||||
// Create the Direct3D object (leave it DX8 or should we try DX9 for WIN32 ?)
|
||||
m_pD3D = Direct3DCreate8(D3D_SDK_VERSION);
|
||||
|
||||
if (m_pD3D == NULL)
|
||||
return false;
|
||||
|
||||
// set up the structure used to create the d3d device
|
||||
D3DPRESENT_PARAMETERS d3dpp;
|
||||
ZeroMemory(&d3dpp, sizeof(d3dpp));
|
||||
|
||||
d3dpp.BackBufferWidth = 640;
|
||||
d3dpp.BackBufferHeight = 480;
|
||||
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
|
||||
d3dpp.BackBufferCount = 1;
|
||||
//d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
|
||||
//d3dpp.EnableAutoDepthStencil = false;
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
|
||||
//Fullscreen only
|
||||
if(!bWindowed)
|
||||
{
|
||||
if(!g_iniFile.m_currentIniEntry.bVSync) {
|
||||
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
}else{
|
||||
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _XBOX
|
||||
g_hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&d3dpp, &m_pD3DDevice);
|
||||
#else //WIN32
|
||||
|
||||
D3DDISPLAYMODE d3ddm;
|
||||
g_hResult = m_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm );
|
||||
d3dpp.BackBufferFormat = d3ddm.Format;
|
||||
d3dpp.Windowed = bWindowed;
|
||||
d3dpp.hDeviceWindow = hDeviceWindow;
|
||||
|
||||
g_hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hDeviceWindow,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&d3dpp, &m_pD3DDevice);
|
||||
#endif //#ifdef _XBOX
|
||||
|
||||
if (FAILED(g_hResult))
|
||||
{
|
||||
g_debug.Print("Error: D3DCreate(), CreateDevice()");
|
||||
#ifndef _XBOX
|
||||
DXTrace(__FILE__, __LINE__, g_hResult, "D3DCreate(), CreateDevice()", TRUE);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
// use an orthogonal matrix for the projection matrix
|
||||
D3DXMATRIX mat;
|
||||
|
||||
D3DXMatrixOrthoOffCenterLH(&mat, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
m_pD3DDevice->SetTransform(D3DTS_PROJECTION, &mat);
|
||||
|
||||
// use an identity matrix for the world and view matrices
|
||||
D3DXMatrixIdentity(&mat);
|
||||
m_pD3DDevice->SetTransform(D3DTS_WORLD, &mat);
|
||||
m_pD3DDevice->SetTransform(D3DTS_VIEW, &mat);
|
||||
|
||||
// disable lighting
|
||||
m_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||||
|
||||
// disable z-buffer (see autodepthstencil)
|
||||
m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CVideo::BeginRender()
|
||||
{
|
||||
m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
D3DCOLOR_XRGB(0, 0, 0),
|
||||
1.0f, 0);
|
||||
|
||||
m_pD3DDevice->BeginScene();
|
||||
#ifdef _XBOX
|
||||
m_pD3DDevice->SetFlickerFilter(g_iniFile.m_currentIniEntry.dwFlickerFilter);
|
||||
m_pD3DDevice->SetSoftDisplayFilter(g_iniFile.m_currentIniEntry.bSoftDisplayFilter);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CVideo::EndRender()
|
||||
{
|
||||
m_pD3DDevice->EndScene();
|
||||
|
||||
m_pD3DDevice->Present(NULL, NULL, NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
void CVideo::CleanUp()
|
||||
{
|
||||
if( m_pD3DDevice != NULL)
|
||||
m_pD3DDevice->Release();
|
||||
|
||||
if( m_pD3D != NULL)
|
||||
m_pD3D->Release();
|
||||
}
|
53
xbox1/RetroLaunch/Video.h
Normal file
53
xbox1/RetroLaunch/Video.h
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* RetroLaunch 2012
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version. This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details. You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
|
||||
* authors: Surreal64 CE Team (http://www.emuxtras.net)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
|
||||
|
||||
typedef struct CustomVertex
|
||||
{
|
||||
float x, y, z;
|
||||
dword color;
|
||||
float u, v;
|
||||
//float rhw;
|
||||
}CustomVertex;
|
||||
|
||||
|
||||
class CVideo
|
||||
{
|
||||
public:
|
||||
CVideo(void);
|
||||
~CVideo(void);
|
||||
|
||||
bool Create(HWND hDeviceWindow, bool bWindowed); //Device creation
|
||||
|
||||
void BeginRender();
|
||||
void EndRender();
|
||||
void CleanUp();
|
||||
|
||||
public:
|
||||
/*Direct3D*/IDirect3D8 *m_pD3D; //D3D object
|
||||
/*D3DDevice*/IDirect3DDevice8 *m_pD3DDevice; //D3D device
|
||||
|
||||
private:
|
||||
|
||||
//nothing
|
||||
};
|
||||
|
||||
extern CVideo g_video;
|
||||
extern HRESULT g_hResult;
|
BIN
xbox1/RetroLaunch/dist/Media/arial.ttf
vendored
Normal file
BIN
xbox1/RetroLaunch/dist/Media/arial.ttf
vendored
Normal file
Binary file not shown.
BIN
xbox1/RetroLaunch/dist/Media/menuMainBG.png
vendored
Normal file
BIN
xbox1/RetroLaunch/dist/Media/menuMainBG.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
xbox1/RetroLaunch/dist/Media/menuMainRomSelectPanel.png
vendored
Normal file
BIN
xbox1/RetroLaunch/dist/Media/menuMainRomSelectPanel.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
0
xbox1/RetroLaunch/dist/Roms/Add roms here.txt
vendored
Normal file
0
xbox1/RetroLaunch/dist/Roms/Add roms here.txt
vendored
Normal file
5
xbox1/RetroLaunch/retroarch.h
Normal file
5
xbox1/RetroLaunch/retroarch.h
Normal file
@ -0,0 +1,5 @@
|
||||
// Automatically generated by the bundler tool from retroarch.jpg
|
||||
|
||||
#define retroarch_NUM_RESOURCES 1UL
|
||||
|
||||
#define retroarch_OFFSET 0UL
|
BIN
xbox1/RetroLaunch/titleimage.jpg
Normal file
BIN
xbox1/RetroLaunch/titleimage.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
Loading…
x
Reference in New Issue
Block a user