Merge branch 'win32-dev'

Conflicts:
	win32/wconfig.cpp
This commit is contained in:
OV2 2010-12-02 22:01:22 +01:00
commit 6574b5591e
39 changed files with 19191 additions and 2230 deletions

View File

@ -186,11 +186,6 @@
#define snprintf _snprintf // needs ANSI compliant name #define snprintf _snprintf // needs ANSI compliant name
#endif #endif
#ifndef MAX
# define MAX(a,b) ((a) > (b)? (a) : (b))
# define MIN(a,b) ((a) < (b)? (a) : (b))
#endif
#define SORT_SECTIONS_BY_SIZE // output #define SORT_SECTIONS_BY_SIZE // output
using namespace std; using namespace std;
@ -208,6 +203,7 @@ ConfigFile::ConfigFile(void) {
void ConfigFile::Clear(void){ void ConfigFile::Clear(void){
data.clear(); data.clear();
sectionSizes.ClearSections();
linectr = 0; linectr = 0;
} }
@ -287,8 +283,10 @@ void ConfigFile::LoadFile(Reader *r, const char *name){
ConfigEntry e(line, section, key, val); ConfigEntry e(line, section, key, val);
e.comment = comment; e.comment = comment;
data.erase(e); if(data.erase(e))
sectionSizes.DecreaseSectionSize(e.section);
data.insert(e); data.insert(e);
sectionSizes.IncreaseSectionSize(e.section);
} while(!eof); } while(!eof);
curConfigFile = NULL; curConfigFile = NULL;
} }
@ -470,12 +468,14 @@ bool ConfigFile::SetString(const char *key, string val, const char *comment){
if(i!=data.end()){ if(i!=data.end()){
e.line=i->line; e.line=i->line;
data.erase(e); data.erase(e);
sectionSizes.DecreaseSectionSize(e.section);
ret=true; ret=true;
} }
if((i==data.end() && (!alphaSort || timeSort)) || (!alphaSort && timeSort)) if((i==data.end() && (!alphaSort || timeSort)) || (!alphaSort && timeSort))
e.line = linectr++; e.line = linectr++;
data.insert(e); data.insert(e);
sectionSizes.IncreaseSectionSize(e.section);
return ret; return ret;
} }
@ -562,7 +562,12 @@ const char* ConfigFile::GetComment(const char *key)
} }
bool ConfigFile::DeleteKey(const char *key){ bool ConfigFile::DeleteKey(const char *key){
return (data.erase(ConfigEntry(key))>0); ConfigEntry e = ConfigEntry(key);
if(data.erase(e)) {
sectionSizes.DecreaseSectionSize(e.section);
return true;
}
return false;
} }
/***********************************************/ /***********************************************/
@ -574,6 +579,7 @@ bool ConfigFile::DeleteSection(const char *section){
if(s==data.end()) return false; if(s==data.end()) return false;
for(e=s; e!=data.end() && e->section==section; e++) ; for(e=s; e!=data.end() && e->section==section; e++) ;
data.erase(s, e); data.erase(s, e);
sectionSizes.DeleteSection(section);
return true; return true;
} }
@ -589,13 +595,8 @@ ConfigFile::secvec_t ConfigFile::GetSection(const char *section){
return v; return v;
} }
int ConfigFile::GetSectionSize(const char *section){ int ConfigFile::GetSectionSize(const std::string section){
int count=0; return sectionSizes.GetSectionSize(section);
const unsigned int seclen=strlen(section);
set<ConfigEntry, ConfigEntry::key_less>::iterator i;
for(i=data.begin(); i!=data.end(); i++)
if(i->section==section || !strncasecmp(section,i->section.c_str(),MIN(seclen,i->section.size()))) count++;
return count;
} }
// Clears all key-value pairs that didn't receive a "Get" or "Exists" command // Clears all key-value pairs that didn't receive a "Get" or "Exists" command
@ -621,8 +622,8 @@ void ConfigFile::ClearLines()
bool ConfigFile::ConfigEntry::section_then_key_less::operator()(const ConfigEntry &a, const ConfigEntry &b) { bool ConfigFile::ConfigEntry::section_then_key_less::operator()(const ConfigEntry &a, const ConfigEntry &b) {
if(curConfigFile && a.section!=b.section){ if(curConfigFile && a.section!=b.section){
const int sva = curConfigFile->GetSectionSize(a.section.c_str()); const int sva = curConfigFile->GetSectionSize(a.section);
const int svb = curConfigFile->GetSectionSize(b.section.c_str()); const int svb = curConfigFile->GetSectionSize(b.section);
if(sva<svb) return true; if(sva<svb) return true;
if(sva>svb) return false; if(sva>svb) return false;
return a.section<b.section; return a.section<b.section;

View File

@ -179,6 +179,7 @@
#define _CONFIG_H_ #define _CONFIG_H_
#include <set> #include <set>
#include <map>
#include <vector> #include <vector>
#include <string> #include <string>
@ -188,6 +189,11 @@
#include "snes9x.h" #include "snes9x.h"
#include "reader.h" #include "reader.h"
#ifndef MAX
# define MAX(a,b) ((a) > (b)? (a) : (b))
# define MIN(a,b) ((a) < (b)? (a) : (b))
#endif
class ConfigFile { class ConfigFile {
public: public:
ConfigFile(void); ConfigFile(void);
@ -222,7 +228,7 @@ class ConfigFile {
bool DeleteSection(const char *section); bool DeleteSection(const char *section);
typedef std::vector<std::pair<std::string,std::string> > secvec_t; typedef std::vector<std::pair<std::string,std::string> > secvec_t;
secvec_t GetSection(const char *section); secvec_t GetSection(const char *section);
int GetSectionSize(const char *section); int GetSectionSize(const std::string section);
// Clears all key-value pairs that didn't receive a Set command, or a Get command with autoAdd on // Clears all key-value pairs that didn't receive a Set command, or a Get command with autoAdd on
void ClearUnused(void); void ClearUnused(void);
@ -349,7 +355,47 @@ class ConfigFile {
friend struct key_less; friend struct key_less;
friend struct line_less; friend struct line_less;
}; };
class SectionSizes {
protected:
std::map<std::string,uint32> sections;
public:
uint32 GetSectionSize(const std::string section) {
uint32 count=0;
uint32 seclen;
std::map<std::string,uint32>::iterator it;
for(it=sections.begin(); it!=sections.end(); it++) {
seclen = MIN(section.size(),it->first.size());
if(it->first==section || !section.compare(0,seclen,it->first,0,seclen)) count+=it->second;
}
return count;
}
void IncreaseSectionSize(const std::string section) {
std::map<std::string,uint32>::iterator it=sections.find(section);
if(it!=sections.end())
it->second++;
else
sections.insert(std::pair<std::string,uint32>(section,1));
}
void DecreaseSectionSize(const std::string section) {
std::map<std::string,uint32>::iterator it=sections.find(section);
if(it!=sections.end())
it->second--;
}
void ClearSections() {
sections.clear();
}
void DeleteSection(const std::string section) {
sections.erase(section);
}
};
std::set<ConfigEntry, ConfigEntry::key_less> data; std::set<ConfigEntry, ConfigEntry::key_less> data;
SectionSizes sectionSizes;
int linectr; int linectr;
static bool defaultAutoAdd; static bool defaultAutoAdd;
static bool niceAlignment; static bool niceAlignment;

View File

@ -3650,7 +3650,7 @@ static void Op42 (void)
S9xMessage(S9X_DEBUG, S9X_DEBUG_OUTPUT, buf); S9xMessage(S9X_DEBUG, S9X_DEBUG_OUTPUT, buf);
if (trace != NULL) if (trace != NULL)
fclose(trace); fclose(trace);
trace = fopen("WDMtrace.log", "ab"); ENSURE_TRACE_OPEN(trace,"WDMtrace.log","ab")
} }
break; break;

View File

@ -1532,8 +1532,7 @@ static void debug_process_command (char *Line)
if (SA1.Flags & TRACE_FLAG) if (SA1.Flags & TRACE_FLAG)
{ {
printf("SA1 CPU instruction tracing enabled.\n"); printf("SA1 CPU instruction tracing enabled.\n");
if (trace2 == NULL) ENSURE_TRACE_OPEN(trace2,"trace_sa1.log","wb")
trace2 = fopen("trace_sa1.log", "wb");
} }
else else
{ {
@ -1549,8 +1548,7 @@ static void debug_process_command (char *Line)
if (CPU.Flags & TRACE_FLAG) if (CPU.Flags & TRACE_FLAG)
{ {
printf("CPU instruction tracing enabled.\n"); printf("CPU instruction tracing enabled.\n");
if (trace == NULL) ENSURE_TRACE_OPEN(trace,"trace.log","wb")
trace = fopen("trace.log", "wb");
} }
else else
{ {
@ -2580,8 +2578,7 @@ void S9xTrace (void)
{ {
char msg[512]; char msg[512];
if (trace == NULL) ENSURE_TRACE_OPEN(trace,"trace.log","a")
trace = fopen("trace.log", "a");
debug_cpu_op_print(msg, Registers.PB, Registers.PCw); debug_cpu_op_print(msg, Registers.PB, Registers.PCw);
fprintf(trace, "%s\n", msg); fprintf(trace, "%s\n", msg);
@ -2591,8 +2588,7 @@ void S9xSA1Trace (void)
{ {
char msg[512]; char msg[512];
if (trace2 == NULL) ENSURE_TRACE_OPEN(trace2,"trace_sa1.log","a")
trace2 = fopen("trace_sa1.log", "a");
debug_sa1_op_print(msg, SA1Registers.PB, SA1Registers.PCw); debug_sa1_op_print(msg, SA1Registers.PB, SA1Registers.PCw);
fprintf(trace2, "%s\n", msg); fprintf(trace2, "%s\n", msg);

View File

@ -180,6 +180,8 @@
#ifndef _DEBUG_H_ #ifndef _DEBUG_H_
#define _DEBUG_H_ #define _DEBUG_H_
#include <string>
struct SBreakPoint struct SBreakPoint
{ {
bool8 Enabled; bool8 Enabled;
@ -187,6 +189,9 @@ struct SBreakPoint
uint16 Address; uint16 Address;
}; };
#define ENSURE_TRACE_OPEN(fp,file,mode) \
if(!fp) {std::string fn=S9xGetDirectory(DEFAULT_DIR);fn+=SLASH_STR file;fp=fopen(fn.c_str(),mode);}
extern struct SBreakPoint S9xBreakpoint[6]; extern struct SBreakPoint S9xBreakpoint[6];
void S9xDoDebug (void); void S9xDoDebug (void);

View File

@ -193,6 +193,7 @@
#endif #endif
#ifdef DEBUGGER #ifdef DEBUGGER
#include "debug.h"
extern FILE *trace; extern FILE *trace;
#endif #endif
@ -493,8 +494,7 @@ void S9xLoadConfigFiles (char **argv, int argc)
if (conf.GetBool("DEBUG::Trace", false)) if (conf.GetBool("DEBUG::Trace", false))
{ {
if (!trace) ENSURE_TRACE_OPEN(trace,"trace.log","wb")
trace = fopen("trace.log", "wb");
CPU.Flags |= TRACE_FLAG; CPU.Flags |= TRACE_FLAG;
} }
#endif #endif
@ -845,8 +845,7 @@ char * S9xParseArgs (char **argv, int argc)
else else
if (!strcasecmp(argv[i], "-trace")) if (!strcasecmp(argv[i], "-trace"))
{ {
if (!trace) ENSURE_TRACE_OPEN(trace,"trace.log","wb")
trace = fopen("trace.log", "wb");
CPU.Flags |= TRACE_FLAG; CPU.Flags |= TRACE_FLAG;
} }
else else

View File

@ -217,17 +217,17 @@ struct AVIFile
long tBytes, ByteBuffer; long tBytes, ByteBuffer;
}; };
static char saved_cur_avi_fnameandext[MAX_PATH]; static TCHAR saved_cur_avi_fnameandext[MAX_PATH];
static char saved_avi_fname[MAX_PATH]; static TCHAR saved_avi_fname[MAX_PATH];
static char saved_avi_ext[MAX_PATH]; static TCHAR saved_avi_ext[MAX_PATH];
static int avi_segnum=0; static int avi_segnum=0;
static struct AVIFile saved_avi_info; static struct AVIFile saved_avi_info;
static int use_prev_options=0; static int use_prev_options=0;
static bool truncate_existing(const char* filename) static bool truncate_existing(const TCHAR* filename)
{ {
// this is only here because AVIFileOpen doesn't seem to do it for us // this is only here because AVIFileOpen doesn't seem to do it for us
FILE* fd = fopen(filename, "wb"); FILE* fd = _tfopen(filename, TEXT("wb"));
if(fd) if(fd)
{ {
fclose(fd); fclose(fd);
@ -313,7 +313,7 @@ void AVISetSoundFormat(const WAVEFORMATEX* wave_format, struct AVIFile* avi_out)
avi_out->sound_added = true; avi_out->sound_added = true;
} }
int AVIBegin(const char* filename, struct AVIFile* _avi_out) int AVIBegin(const TCHAR* filename, struct AVIFile* _avi_out)
{ {
AVIFile& avi = *_avi_out; AVIFile& avi = *_avi_out;
int result = 0; int result = 0;
@ -390,13 +390,13 @@ int AVIBegin(const char* filename, struct AVIFile* _avi_out)
avi.tBytes = 0; avi.tBytes = 0;
avi.ByteBuffer = 0; avi.ByteBuffer = 0;
strncpy(saved_cur_avi_fnameandext,filename,MAX_PATH); lstrcpyn(saved_cur_avi_fnameandext,filename,MAX_PATH);
strncpy(saved_avi_fname,filename,MAX_PATH); lstrcpyn(saved_avi_fname,filename,MAX_PATH);
char* dot = strrchr(saved_avi_fname, '.'); TCHAR* dot = _tcsrchr(saved_avi_fname, TEXT('.'));
if(dot && dot > strrchr(saved_avi_fname, '/') && dot > strrchr(saved_avi_fname, '\\')) if(dot && dot > _tcsrchr(saved_avi_fname, TEXT('/')) && dot > _tcsrchr(saved_avi_fname, TEXT('\\')))
{ {
strcpy(saved_avi_ext,dot); lstrcpy(saved_avi_ext,dot);
dot[0]='\0'; dot[0]=TEXT('\0');
} }
// success // success
@ -452,17 +452,17 @@ int AVIGetSoundFormat(const struct AVIFile* avi_out, const WAVEFORMATEX** ppForm
static int AVINextSegment(struct AVIFile* avi_out) static int AVINextSegment(struct AVIFile* avi_out)
{ {
char avi_fname[MAX_PATH]; TCHAR avi_fname[MAX_PATH];
strcpy(avi_fname,saved_avi_fname); lstrcpy(avi_fname,saved_avi_fname);
char avi_fname_temp[MAX_PATH]; TCHAR avi_fname_temp[MAX_PATH];
sprintf(avi_fname_temp, "%s_part%d%s", avi_fname, avi_segnum+2, saved_avi_ext); _stprintf(avi_fname_temp, TEXT("%s_part%d%s"), avi_fname, avi_segnum+2, saved_avi_ext);
saved_avi_info=*avi_out; saved_avi_info=*avi_out;
use_prev_options=1; use_prev_options=1;
avi_segnum++; avi_segnum++;
clean_up(avi_out); clean_up(avi_out);
int ret = AVIBegin(avi_fname_temp, avi_out); int ret = AVIBegin(avi_fname_temp, avi_out);
use_prev_options=0; use_prev_options=0;
strcpy(saved_avi_fname,avi_fname); lstrcpy(saved_avi_fname,avi_fname);
return ret; return ret;
} }

View File

@ -200,7 +200,7 @@ void AVISetSoundFormat(const WAVEFORMATEX* wave_format, struct AVIFile* avi_out)
// after setting up output options, start writing with this // after setting up output options, start writing with this
// returns 1 if successful, 0 otherwise // returns 1 if successful, 0 otherwise
// check the return value! // check the return value!
int AVIBegin(const char* filename, struct AVIFile* avi_out); int AVIBegin(const TCHAR* filename, struct AVIFile* avi_out);
// get the format in use from an already existing avi output object // get the format in use from an already existing avi output object
// returns 1 if successful, 0 otherwise // returns 1 if successful, 0 otherwise

View File

@ -178,21 +178,18 @@
#pragma comment( lib, "d3dx9" ) #pragma comment( lib, "d3dx9" )
#pragma comment( lib, "DxErr9" ) #pragma comment( lib, "DxErr9" )
#include "../snes9x.h"
#include <Dxerr.h>
#include <tchar.h>
#include "cdirect3d.h" #include "cdirect3d.h"
#include "win32_display.h" #include "win32_display.h"
#include "../snes9x.h"
#include "../gfx.h" #include "../gfx.h"
#include "../display.h"
#include "wsnes9x.h" #include "wsnes9x.h"
#include <Dxerr.h>
#include <commctrl.h> #include <commctrl.h>
#include "../filter/hq2x.h" #include "../filter/hq2x.h"
#include "../filter/2xsai.h" #include "../filter/2xsai.h"
#define RenderMethod ((Src.Height > SNES_HEIGHT_EXTENDED || Src.Width == 512) ? RenderMethodHiRes : RenderMethod)
#ifndef max #ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b))
#endif #endif
@ -214,7 +211,15 @@ CDirect3D::CDirect3D()
afterRenderHeight = 0; afterRenderHeight = 0;
quadTextureSize = 0; quadTextureSize = 0;
fullscreen = false; fullscreen = false;
iFilterScale = 0; filterScale = 1;
for(int i = 0; i < MAX_SHADER_TEXTURES; i++) {
rubyLUT[i] = NULL;
}
effect=NULL;
shader_compiled=false;
shaderTimer = 1.0f;
shaderTimeStart = 0;
shaderTimeElapsed = 0;
} }
/* CDirect3D::~CDirect3D() /* CDirect3D::~CDirect3D()
@ -246,7 +251,7 @@ bool CDirect3D::Initialize(HWND hWnd)
ZeroMemory(&dPresentParams, sizeof(dPresentParams)); ZeroMemory(&dPresentParams, sizeof(dPresentParams));
dPresentParams.hDeviceWindow = hWnd; dPresentParams.hDeviceWindow = hWnd;
dPresentParams.Windowed = TRUE; dPresentParams.Windowed = true;
dPresentParams.BackBufferCount = GUI.DoubleBuffered?2:1; dPresentParams.BackBufferCount = GUI.DoubleBuffered?2:1;
dPresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD; dPresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
dPresentParams.BackBufferFormat = D3DFMT_UNKNOWN; dPresentParams.BackBufferFormat = D3DFMT_UNKNOWN;
@ -268,20 +273,12 @@ bool CDirect3D::Initialize(HWND hWnd)
return false; return false;
} }
//VideoMemory controls if we want bilinear filtering
if(GUI.BilinearFilter) {
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
} else {
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
}
pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
init_done = true; init_done = true;
ApplyDisplayChanges();
return true; return true;
} }
@ -289,6 +286,7 @@ bool CDirect3D::Initialize(HWND hWnd)
void CDirect3D::DeInitialize() void CDirect3D::DeInitialize()
{ {
DestroyDrawSurface(); DestroyDrawSurface();
SetShader(NULL);
if(vertexBuffer) { if(vertexBuffer) {
vertexBuffer->Release(); vertexBuffer->Release();
@ -310,7 +308,203 @@ void CDirect3D::DeInitialize()
afterRenderHeight = 0; afterRenderHeight = 0;
quadTextureSize = 0; quadTextureSize = 0;
fullscreen = false; fullscreen = false;
iFilterScale = 0; filterScale = 0;
}
bool CDirect3D::SetShader(const TCHAR *file)
{
//MUDLORD: the guts
//Compiles a shader from files on disc
//Sets LUT textures to texture files in PNG format.
TCHAR folder[MAX_PATH];
TCHAR rubyLUTfileName[MAX_PATH];
TCHAR *slash;
char *shaderText = NULL;
TCHAR errorMsg[MAX_PATH + 50];
IXMLDOMDocument * pXMLDoc = NULL;
IXMLDOMElement * pXDE = NULL;
IXMLDOMNode * pXDN = NULL;
BSTR queryString, nodeContent;
HRESULT hr;
shader_compiled = false;
shaderTimer = 1.0f;
shaderTimeStart = 0;
shaderTimeElapsed = 0;
if(effect) {
effect->Release();
effect = NULL;
}
for(int i = 0; i < MAX_SHADER_TEXTURES; i++) {
if (rubyLUT[i] != NULL) {
rubyLUT[i]->Release();
rubyLUT[i] = NULL;
}
}
if (file == NULL || *file==TEXT('\0'))
return true;
hr = CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pXMLDoc));
if(FAILED(hr)) {
MessageBox(NULL, TEXT("Error creating XML Parser"), TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION);
return false;
}
VARIANT fileName;
VARIANT_BOOL ret;
fileName.vt = VT_BSTR;
#ifdef UNICODE
fileName.bstrVal = SysAllocString(file);
#else
wchar_t tempfilename[MAX_PATH];
MultiByteToWideChar(CP_UTF8,0,file,-1,tempfilename,MAX_PATH);
fileName.bstrVal = SysAllocString(tempfilename);
#endif
hr = pXMLDoc->load(fileName,&ret);
SysFreeString(fileName.bstrVal);
if(FAILED(hr) || hr==S_FALSE) {
_stprintf(errorMsg,TEXT("Error loading HLSL shader file:\n%s"),file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
}
VARIANT attributeValue;
BSTR attributeName;
hr = pXMLDoc->get_documentElement(&pXDE);
if(FAILED(hr) || hr==S_FALSE) {
_stprintf(errorMsg,TEXT("Error loading root element from file:\n%s"),file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
}
attributeName=SysAllocString(L"language");
pXDE->getAttribute(attributeName,&attributeValue);
SysFreeString(attributeName);
pXDE->Release();
if(attributeValue.vt!=VT_BSTR || lstrcmpiW(attributeValue.bstrVal,L"hlsl")) {
_stprintf(errorMsg,TEXT("Shader language is <%s>, expected <HLSL> in file:\n%s"),attributeValue.bstrVal,file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
pXMLDoc->Release();
return false;
}
if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
queryString=SysAllocString(L"/shader/source");
hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
SysFreeString(queryString);
if(hr == S_OK) {
hr = pXDN->get_text(&nodeContent);
if(hr == S_OK) {
int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,shaderText,0,NULL,NULL);
shaderText = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,shaderText,requiredChars,NULL,NULL);
}
SysFreeString(nodeContent);
pXDN->Release();
pXDN = NULL;
}
pXMLDoc->Release();
if(!shaderText) {
_stprintf(errorMsg,TEXT("No HLSL shader program in file:\n%s"),file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION);
return false;
}
LPD3DXBUFFER pBufferErrors = NULL;
hr = D3DXCreateEffect( pDevice,shaderText,strlen(shaderText),NULL, NULL,
D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY, NULL, &effect,
&pBufferErrors );
delete[] shaderText;
if( FAILED(hr) ) {
_stprintf(errorMsg,TEXT("Error parsing HLSL shader file:\n%s"),file);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
if(pBufferErrors) {
LPVOID pCompilErrors = pBufferErrors->GetBufferPointer();
MessageBox(NULL, (const TCHAR*)pCompilErrors, TEXT("FX Compile Error"),
MB_OK|MB_ICONEXCLAMATION);
}
return false;
}
lstrcpy(folder,file);
slash = _tcsrchr(folder,TEXT('\\'));
if(slash)
*(slash+1)=TEXT('\0');
else
*folder=TEXT('\0');
SetCurrentDirectory(S9xGetDirectoryT(DEFAULT_DIR));
for(int i = 0; i < MAX_SHADER_TEXTURES; i++) {
_stprintf(rubyLUTfileName, TEXT("%srubyLUT%d.png"), folder, i);
hr = D3DXCreateTextureFromFile(pDevice,rubyLUTfileName,&rubyLUT[i]);
if FAILED(hr){
rubyLUT[i] = NULL;
}
}
D3DXHANDLE hTech;
effect->FindNextValidTechnique(NULL,&hTech);
effect->SetTechnique( hTech );
shader_compiled = true;
return true;
}
void CDirect3D::SetShaderVars()
{
D3DXVECTOR4 rubyTextureSize;
D3DXVECTOR4 rubyInputSize;
D3DXVECTOR4 rubyOutputSize;
D3DXHANDLE rubyTimer;
int shaderTime = GetTickCount();
shaderTimeElapsed += shaderTime - shaderTimeStart;
shaderTimeStart = shaderTime;
if(shaderTimeElapsed > 100) {
shaderTimeElapsed = 0;
shaderTimer += 0.01f;
}
rubyTextureSize.x = rubyTextureSize.y = (float)quadTextureSize;
rubyTextureSize.z = rubyTextureSize.w = 1.0 / quadTextureSize;
rubyInputSize.x = (float)afterRenderWidth;
rubyInputSize.y = (float)afterRenderHeight;
rubyInputSize.z = 1.0 / rubyInputSize.y;
rubyInputSize.w = 1.0 / rubyInputSize.z;
rubyOutputSize.x = GUI.Stretch?(float)dPresentParams.BackBufferWidth:(float)afterRenderWidth;
rubyOutputSize.y = GUI.Stretch?(float)dPresentParams.BackBufferHeight:(float)afterRenderHeight;
rubyOutputSize.z = 1.0 / rubyOutputSize.y;
rubyOutputSize.w = 1.0 / rubyOutputSize.x;
rubyTimer = effect->GetParameterByName(0, "rubyTimer");
effect->SetFloat(rubyTimer, shaderTimer);
effect->SetVector("rubyTextureSize", &rubyTextureSize);
effect->SetVector("rubyInputSize", &rubyInputSize);
effect->SetVector("rubyOutputSize", &rubyOutputSize);
effect->SetTexture("rubyTexture", drawSurface);
for(int i = 0; i < MAX_SHADER_TEXTURES; i++) {
char rubyLUTName[256];
sprintf(rubyLUTName, "rubyLUT%d", i);
if (rubyLUT[i] != NULL) {
effect->SetTexture( rubyLUTName, rubyLUT[i] );
}
}
} }
/* CDirect3D::Render /* CDirect3D::Render
@ -323,7 +517,7 @@ void CDirect3D::Render(SSurface Src)
{ {
SSurface Dst; SSurface Dst;
RECT dstRect; RECT dstRect;
int iNewFilterScale; unsigned int newFilterScale;
D3DLOCKED_RECT lr; D3DLOCKED_RECT lr;
D3DLOCKED_RECT lrConv; D3DLOCKED_RECT lrConv;
HRESULT hr; HRESULT hr;
@ -332,9 +526,9 @@ void CDirect3D::Render(SSurface Src)
//create a new draw surface if the filter scale changes //create a new draw surface if the filter scale changes
//at least factor 2 so we can display unscaled hi-res images //at least factor 2 so we can display unscaled hi-res images
iNewFilterScale = max(2,max(GetFilterScale(GUI.ScaleHiRes),GetFilterScale(GUI.Scale))); newFilterScale = max(2,max(GetFilterScale(GUI.ScaleHiRes),GetFilterScale(GUI.Scale)));
if(iNewFilterScale!=iFilterScale) { if(newFilterScale!=filterScale) {
ChangeDrawSurfaceSize(iNewFilterScale); ChangeDrawSurfaceSize(newFilterScale);
} }
if(FAILED(hr = pDevice->TestCooperativeLevel())) { if(FAILED(hr = pDevice->TestCooperativeLevel())) {
@ -345,7 +539,7 @@ void CDirect3D::Render(SSurface Src)
ResetDevice(); ResetDevice();
return; return;
default: default:
DXTRACE_ERR( TEXT("Internal driver error"), hr); DXTRACE_ERR_MSGBOX( TEXT("Internal driver error"), hr);
return; return;
} }
} }
@ -362,8 +556,8 @@ void CDirect3D::Render(SSurface Src)
RenderMethod (Src, Dst, &dstRect); RenderMethod (Src, Dst, &dstRect);
if(!Settings.AutoDisplayMessages) { if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(GUI.Scale)); WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(GUI.Scale)); S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
} }
drawSurface->UnlockRect(0); drawSurface->UnlockRect(0);
@ -384,7 +578,22 @@ void CDirect3D::Render(SSurface Src)
pDevice->SetTexture(0, drawSurface); pDevice->SetTexture(0, drawSurface);
pDevice->SetFVF(FVF_COORDS_TEX); pDevice->SetFVF(FVF_COORDS_TEX);
pDevice->SetStreamSource(0,vertexBuffer,0,sizeof(VERTEX)); pDevice->SetStreamSource(0,vertexBuffer,0,sizeof(VERTEX));
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
if (shader_compiled) {
UINT passes;
SetShaderVars();
hr = effect->Begin(&passes, 0);
for(UINT pass = 0; pass < passes; pass++ ) {
effect->BeginPass(pass);
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
effect->EndPass();
}
effect->End();
} else {
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
}
pDevice->EndScene(); pDevice->EndScene();
@ -399,12 +608,12 @@ and creates a new texture
*/ */
void CDirect3D::CreateDrawSurface() void CDirect3D::CreateDrawSurface()
{ {
int neededSize; unsigned int neededSize;
HRESULT hr; HRESULT hr;
//we need at least 512 pixels (SNES_WIDTH * 2) so we can start with that value //we need at least 512 pixels (SNES_WIDTH * 2) so we can start with that value
quadTextureSize = 512; quadTextureSize = 512;
neededSize = SNES_WIDTH * iFilterScale; neededSize = SNES_WIDTH * filterScale;
while(quadTextureSize < neededSize) while(quadTextureSize < neededSize)
quadTextureSize *=2; quadTextureSize *=2;
@ -462,13 +671,13 @@ bool CDirect3D::BlankTexture(LPDIRECT3DTEXTURE9 texture)
changes the draw surface size: deletes the old textures, creates a new texture changes the draw surface size: deletes the old textures, creates a new texture
and calculate new vertices and calculate new vertices
IN: IN:
iScale - the scale that has to fit into the textures scale - the scale that has to fit into the textures
----- -----
returns true if successful, false otherwise returns true if successful, false otherwise
*/ */
bool CDirect3D::ChangeDrawSurfaceSize(int iScale) bool CDirect3D::ChangeDrawSurfaceSize(unsigned int scale)
{ {
iFilterScale = iScale; filterScale = scale;
if(pDevice) { if(pDevice) {
DestroyDrawSurface(); DestroyDrawSurface();
@ -485,56 +694,10 @@ calculates the vertex coordinates
*/ */
void CDirect3D::SetupVertices() void CDirect3D::SetupVertices()
{ {
float xFactor;
float yFactor;
float minFactor;
float renderWidthCalc,renderHeightCalc;
RECT drawRect; RECT drawRect;
int hExtend = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
float snesAspect = (float)GUI.AspectWidth/hExtend;
void *pLockedVertexBuffer; void *pLockedVertexBuffer;
if(GUI.Stretch) { drawRect = CalculateDisplayRect(afterRenderWidth,afterRenderHeight,dPresentParams.BackBufferWidth,dPresentParams.BackBufferHeight);
if(GUI.AspectRatio) {
//fix for hi-res images with FILTER_NONE
//where we need to correct the aspect ratio
renderWidthCalc = (float)afterRenderWidth;
renderHeightCalc = (float)afterRenderHeight;
if(renderWidthCalc/renderHeightCalc>snesAspect)
renderWidthCalc = renderHeightCalc * snesAspect;
else if(renderWidthCalc/renderHeightCalc<snesAspect)
renderHeightCalc = renderWidthCalc / snesAspect;
xFactor = (float)dPresentParams.BackBufferWidth / renderWidthCalc;
yFactor = (float)dPresentParams.BackBufferHeight / renderHeightCalc;
minFactor = xFactor < yFactor ? xFactor : yFactor;
drawRect.right = (LONG)(renderWidthCalc * minFactor);
drawRect.bottom = (LONG)(renderHeightCalc * minFactor);
drawRect.left = (dPresentParams.BackBufferWidth - drawRect.right) / 2;
drawRect.top = (dPresentParams.BackBufferHeight - drawRect.bottom) / 2;
drawRect.right += drawRect.left;
drawRect.bottom += drawRect.top;
} else {
drawRect.top = 0;
drawRect.left = 0;
drawRect.right = dPresentParams.BackBufferWidth;
drawRect.bottom = dPresentParams.BackBufferHeight;
}
} else {
drawRect.left = ((int)(dPresentParams.BackBufferWidth) - (int)afterRenderWidth) / 2;
drawRect.top = ((int)(dPresentParams.BackBufferHeight) - (int)afterRenderHeight) / 2;
if(drawRect.left < 0) drawRect.left = 0;
if(drawRect.top < 0) drawRect.top = 0;
drawRect.right = drawRect.left + afterRenderWidth;
drawRect.bottom = drawRect.top + afterRenderHeight;
//the lines below would downsize the image if window size is smaller than the output, but
//since the old directdraw code did not do that I've left it out
//if(drawRect.right > dPresentParams.BackBufferWidth) drawRect.right = dPresentParams.BackBufferWidth;
//if(drawRect.bottom > dPresentParams.BackBufferHeight) drawRect.bottom = dPresentParams.BackBufferHeight;
}
float tX = (float)afterRenderWidth / (float)quadTextureSize; float tX = (float)afterRenderWidth / (float)quadTextureSize;
float tY = (float)afterRenderHeight / (float)quadTextureSize; float tY = (float)afterRenderHeight / (float)quadTextureSize;
@ -566,7 +729,7 @@ bool CDirect3D::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
//if we already have the desired size no change is necessary //if we already have the desired size no change is necessary
//during fullscreen no changes are allowed //during fullscreen no changes are allowed
if(fullscreen || dPresentParams.BackBufferWidth == newWidth && dPresentParams.BackBufferHeight == newHeight) if(dPresentParams.BackBufferWidth == newWidth && dPresentParams.BackBufferHeight == newHeight)
return true; return true;
if(!ResetDevice()) if(!ResetDevice())
@ -583,13 +746,16 @@ returns true if successful, false otherwise
*/ */
bool CDirect3D::ResetDevice() bool CDirect3D::ResetDevice()
{ {
if(!pDevice) return false; if(!init_done) return false;
HRESULT hr; HRESULT hr;
//release prior to reset //release prior to reset
DestroyDrawSurface(); DestroyDrawSurface();
if(effect)
effect->OnLostDevice();
//zero or unknown values result in the current window size/display settings //zero or unknown values result in the current window size/display settings
dPresentParams.BackBufferWidth = 0; dPresentParams.BackBufferWidth = 0;
dPresentParams.BackBufferHeight = 0; dPresentParams.BackBufferHeight = 0;
@ -616,6 +782,9 @@ bool CDirect3D::ResetDevice()
return false; return false;
} }
if(effect)
effect->OnResetDevice();
if(GUI.BilinearFilter) { if(GUI.BilinearFilter) {
pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
@ -724,5 +893,10 @@ returns true if successful, false otherwise
*/ */
bool CDirect3D::ApplyDisplayChanges(void) bool CDirect3D::ApplyDisplayChanges(void)
{ {
if(GUI.shaderEnabled && GUI.HLSLshaderFileName)
SetShader(GUI.HLSLshaderFileName);
else
SetShader(NULL);
return ChangeRenderSize(0,0); return ChangeRenderSize(0,0);
} }

View File

@ -177,8 +177,12 @@
#ifndef W9XDIRECT3D_H #ifndef W9XDIRECT3D_H
#define W9XDIRECT3D_H #define W9XDIRECT3D_H
#include <windows.h> #define MAX_SHADER_TEXTURES 8
#include <d3d9.h> #include <d3d9.h>
#include <d3dx9.h>
#include <windows.h>
#include "render.h" #include "render.h"
#include "wsnes9x.h" #include "wsnes9x.h"
#include "IS9xDisplayOutput.h" #include "IS9xDisplayOutput.h"
@ -205,19 +209,28 @@ private:
LPDIRECT3DVERTEXBUFFER9 vertexBuffer; LPDIRECT3DVERTEXBUFFER9 vertexBuffer;
D3DPRESENT_PARAMETERS dPresentParams; D3DPRESENT_PARAMETERS dPresentParams;
int iFilterScale; //the current maximum filter scale (at least 2) unsigned int filterScale; //the current maximum filter scale (at least 2)
unsigned int afterRenderWidth, afterRenderHeight; //dimensions after filter has been applied unsigned int afterRenderWidth, afterRenderHeight; //dimensions after filter has been applied
unsigned int quadTextureSize; //size of the texture (only multiples of 2) unsigned int quadTextureSize; //size of the texture (only multiples of 2)
bool fullscreen; //are we currently displaying in fullscreen mode bool fullscreen; //are we currently displaying in fullscreen mode
VERTEX triangleStripVertices[4]; //the 4 vertices that make up our display rectangle VERTEX triangleStripVertices[4]; //the 4 vertices that make up our display rectangle
LPD3DXEFFECT effect;
LPDIRECT3DTEXTURE9 rubyLUT[MAX_SHADER_TEXTURES];
bool shader_compiled;
float shaderTimer;
int shaderTimeStart;
int shaderTimeElapsed;
bool BlankTexture(LPDIRECT3DTEXTURE9 texture); bool BlankTexture(LPDIRECT3DTEXTURE9 texture);
void CreateDrawSurface(); void CreateDrawSurface();
void DestroyDrawSurface(); void DestroyDrawSurface();
bool ChangeDrawSurfaceSize(int iScale); bool ChangeDrawSurfaceSize(unsigned int scale);
void SetupVertices(); void SetupVertices();
bool ResetDevice(); bool ResetDevice();
void SetShaderVars();
bool SetShader(const TCHAR *file);
public: public:
CDirect3D(); CDirect3D();

View File

@ -206,6 +206,8 @@ CDirectDraw::CDirectDraw()
depth = -1; depth = -1;
doubleBuffered = false; doubleBuffered = false;
dDinitialized = false; dDinitialized = false;
convertBuffer = NULL;
filterScale = 0;
} }
CDirectDraw::~CDirectDraw() CDirectDraw::~CDirectDraw()
@ -270,6 +272,11 @@ void CDirectDraw::DeInitialize()
lpDD->Release(); lpDD->Release();
lpDD = NULL; lpDD = NULL;
} }
if(convertBuffer) {
delete [] convertBuffer;
convertBuffer = NULL;
}
filterScale = 0;
dDinitialized = false; dDinitialized = false;
} }
@ -520,7 +527,6 @@ static bool LockSurface2 (LPDIRECTDRAWSURFACE2 lpDDSurface, SSurface *lpSurface)
return (false); return (false);
hResult = lpDDSurface->Restore(); hResult = lpDDSurface->Restore();
GUI.ScreenCleared = true;
if (hResult != DD_OK) if (hResult != DD_OK)
return (false); return (false);
@ -543,6 +549,10 @@ void CDirectDraw::Render(SSurface Src)
DDSCAPS caps; DDSCAPS caps;
unsigned int newFilterScale;
if(!dDinitialized) return;
ZeroMemory(&caps,sizeof(DDSCAPS)); ZeroMemory(&caps,sizeof(DDSCAPS));
caps.dwCaps = DDSCAPS_BACKBUFFER; caps.dwCaps = DDSCAPS_BACKBUFFER;
@ -561,11 +571,19 @@ void CDirectDraw::Render(SSurface Src)
if (!GUI.DepthConverted) if (!GUI.DepthConverted)
{ {
SSurface tmp; SSurface tmp;
static BYTE buf [256 * 239 * 4*3*3];
tmp.Surface = buf; newFilterScale = max(2,max(GetFilterScale(GUI.ScaleHiRes),GetFilterScale(GUI.Scale)));
if(GUI.Scale == FILTER_NONE) { if(newFilterScale!=filterScale) {
if(convertBuffer)
delete [] convertBuffer;
filterScale = newFilterScale;
convertBuffer = new unsigned char[SNES_WIDTH * sizeof(uint16) * SNES_HEIGHT_EXTENDED * sizeof(uint16) *filterScale*filterScale]();
}
tmp.Surface = convertBuffer;
if(CurrentScale == FILTER_NONE) {
tmp.Pitch = Src.Pitch; tmp.Pitch = Src.Pitch;
tmp.Width = Src.Width; tmp.Width = Src.Width;
tmp.Height = Src.Height; tmp.Height = Src.Height;
@ -583,8 +601,8 @@ void CDirectDraw::Render(SSurface Src)
} }
if(!Settings.AutoDisplayMessages) { if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, (Dst.Pitch*8/GUI.ScreenDepth), srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(GUI.Scale)); WinSetCustomDisplaySurface((void *)Dst.Surface, (Dst.Pitch*8/GUI.ScreenDepth), srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(GUI.Scale)); S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, srcRect.right-srcRect.left, srcRect.bottom-srcRect.top, GetFilterScale(CurrentScale));
} }
RECT lastRect = SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames]; RECT lastRect = SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames];
@ -719,6 +737,10 @@ void CDirectDraw::Render(SSurface Src)
} }
} }
if(GUI.Vsync) {
lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN,NULL);
}
lpDDSPrimary2->Flip (NULL, GUI.Vsync?DDFLIP_WAIT:DDFLIP_NOVSYNC); lpDDSPrimary2->Flip (NULL, GUI.Vsync?DDFLIP_WAIT:DDFLIP_NOVSYNC);
SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames] = dstRect; SizeHistory [GUI.FlipCounter % GUI.NumFlipFrames] = dstRect;
@ -726,7 +748,8 @@ void CDirectDraw::Render(SSurface Src)
bool CDirectDraw::ApplyDisplayChanges(void) bool CDirectDraw::ApplyDisplayChanges(void)
{ {
return true; return SetDisplayMode (GUI.FullscreenMode.width, GUI.FullscreenMode.height, max(GetFilterScale(GUI.Scale), GetFilterScale(GUI.ScaleHiRes)), GUI.FullscreenMode.depth, GUI.FullscreenMode.rate,
TRUE, GUI.DoubleBuffered);
} }
bool CDirectDraw::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight) bool CDirectDraw::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
@ -856,6 +879,8 @@ HRESULT CALLBACK EnumModesCallback( LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpCo
void CDirectDraw::EnumModes(std::vector<dMode> *modeVector) void CDirectDraw::EnumModes(std::vector<dMode> *modeVector)
{ {
if(!dDinitialized)
return;
lpDD->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,(void *)modeVector,(LPDDENUMMODESCALLBACK)EnumModesCallback); lpDD->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,(void *)modeVector,(LPDDENUMMODESCALLBACK)EnumModesCallback);
} }

View File

@ -209,6 +209,9 @@ public:
bool clipped; bool clipped;
bool dDinitialized; bool dDinitialized;
unsigned char *convertBuffer;
unsigned int filterScale;
DDPIXELFORMAT DDPixelFormat; DDPIXELFORMAT DDPixelFormat;
public: public:
bool SetDisplayMode( bool SetDisplayMode(

View File

@ -202,7 +202,6 @@ CDirectSound::CDirectSound()
bufferSize = 0; bufferSize = 0;
blockSamples = 0; blockSamples = 0;
hTimer = NULL; hTimer = NULL;
hTimerQueue = NULL;
} }
CDirectSound::~CDirectSound() CDirectSound::~CDirectSound()
@ -268,12 +267,6 @@ opened DirectSound in exclusive mode."),
} }
} }
hTimerQueue = CreateTimerQueue();
if(!hTimerQueue) {
DeInitDirectSound();
return false;
}
return (initDone); return (initDone);
} }
@ -292,10 +285,6 @@ void CDirectSound::DeInitDirectSound()
lpDS->Release (); lpDS->Release ();
lpDS = NULL; lpDS = NULL;
} }
if(hTimerQueue) {
DeleteTimerQueueEx(hTimer,NULL);
hTimerQueue = NULL;
}
} }
/* CDirectSound::InitSoundBuffer /* CDirectSound::InitSoundBuffer
@ -371,8 +360,7 @@ deinitializes the DirectSound/temp buffers and stops the mixing timer
void CDirectSound::DeInitSoundBuffer() void CDirectSound::DeInitSoundBuffer()
{ {
if(hTimer) { if(hTimer) {
if(!DeleteTimerQueueTimer(hTimerQueue,hTimer,INVALID_HANDLE_VALUE)) timeKillEvent(hTimer);
DeleteTimerQueueTimer(hTimerQueue,hTimer,INVALID_HANDLE_VALUE);
hTimer = NULL; hTimer = NULL;
} }
if( lpDSB != NULL) if( lpDSB != NULL)
@ -428,8 +416,8 @@ bool CDirectSound::SetupSound()
last_block = blockCount - 1; last_block = blockCount - 1;
hTimer = timeSetEvent (blockTime/2, blockTime/2, SoundTimerCallback, (DWORD_PTR)this, TIME_PERIODIC);
if(!CreateTimerQueueTimer(&hTimer,hTimerQueue,SoundTimerCallback,(void *)this,blockTime/2,blockTime/2,WT_EXECUTEINIOTHREAD)) { if(!hTimer) {
DeInitSoundBuffer(); DeInitSoundBuffer();
return false; return false;
} }
@ -460,6 +448,8 @@ void CDirectSound::MixSound()
HRESULT hResult; HRESULT hResult;
DWORD curr_block; DWORD curr_block;
if(!initDone)
return;
lpDSB->GetCurrentPosition (&play_pos, NULL); lpDSB->GetCurrentPosition (&play_pos, NULL);
@ -509,8 +499,9 @@ void CDirectSound::MixSound()
/* CDirectSound::SoundTimerCallback /* CDirectSound::SoundTimerCallback
Timer callback that tries to mix a new block. Called twice each block. Timer callback that tries to mix a new block. Called twice each block.
*/ */
VOID CALLBACK CDirectSound::SoundTimerCallback(PVOID lpParameter,BOOLEAN TimerOrWaitFired) {
CDirectSound *S9xDirectSound = (CDirectSound *)lpParameter; VOID CALLBACK CDirectSound::SoundTimerCallback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) {
CDirectSound *S9xDirectSound = (CDirectSound *)dwUser;
S9xDirectSound->MixSound(); S9xDirectSound->MixSound();
} }

View File

@ -199,17 +199,14 @@ private:
int blockCount; // number of blocks in the buffer int blockCount; // number of blocks in the buffer
int blockSize; // bytes in one block int blockSize; // bytes in one block
int blockSamples; int blockSamples; // samples in one block
int bufferSize; // bytes in the whole buffer int bufferSize; // bytes in the whole buffer
int blockTime; int blockTime; // ms in one block
DWORD last_block; // the last block that was mixed DWORD last_block; // the last block that was mixed
bool initDone; // has init been called successfully? bool initDone; // has init been called successfully?
HANDLE hTimerQueue; // handle to the mixing thread DWORD hTimer; // mixing timer
HANDLE hTimer;
volatile bool threadExit; // mixing thread exit signal
bool InitDirectSound (); bool InitDirectSound ();
void DeInitDirectSound(); void DeInitDirectSound();
@ -217,7 +214,7 @@ private:
bool InitSoundBuffer(); bool InitSoundBuffer();
void DeInitSoundBuffer(); void DeInitSoundBuffer();
static VOID CALLBACK CDirectSound::SoundTimerCallback(PVOID lpParameter,BOOLEAN TimerOrWaitFired); static VOID CALLBACK SoundTimerCallback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
void ProcessSound(); void ProcessSound();
void MixSound(); void MixSound();

637
win32/COpenGL.cpp Normal file
View File

@ -0,0 +1,637 @@
#include "COpenGL.h"
#include "win32_display.h"
#include "../snes9x.h"
#include "../gfx.h"
#include "../display.h"
#include "wsnes9x.h"
#include <msxml2.h>
#include "../filter/hq2x.h"
#include "../filter/2xsai.h"
COpenGL::COpenGL(void)
{
hDC = NULL;
hRC = NULL;
hWnd = NULL;
drawTexture = 0;
initDone = false;
quadTextureSize = 0;
filterScale = 0;
afterRenderWidth = 0;
afterRenderHeight = 0;
fullscreen = false;
shaderFunctionsLoaded = false;
shaderCompiled = false;
pboFunctionsLoaded = false;
shaderProgram = 0;
vertexShader = 0;
fragmentShader = 0;
}
COpenGL::~COpenGL(void)
{
DeInitialize();
}
bool COpenGL::Initialize(HWND hWnd)
{
int pfdIndex;
RECT windowRect;
this->hWnd = hWnd;
this->hDC = GetDC(hWnd);
PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
16, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};
PIXELFORMATDESCRIPTOR pfdSel;
if(!(pfdIndex=ChoosePixelFormat(hDC,&pfd))) {
DeInitialize();
return false;
}
if(!SetPixelFormat(hDC,pfdIndex,&pfd)) {
DeInitialize();
return false;
}
if(!(hRC=wglCreateContext(hDC))) {
DeInitialize();
return false;
}
if(!wglMakeCurrent(hDC,hRC)) {
DeInitialize();
return false;
}
LoadPBOFunctions();
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress( "wglSwapIntervalEXT" );
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0.0, 1.0, 0.0, 1.0, -1, 1);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
GetClientRect(hWnd,&windowRect);
ChangeRenderSize(windowRect.right,windowRect.bottom);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClear(GL_COLOR_BUFFER_BIT);
SwapBuffers(hDC);
initDone = true;
return true;
}
void COpenGL::DeInitialize()
{
initDone = false;
if(shaderCompiled)
SetShaders(NULL);
DestroyDrawSurface();
wglMakeCurrent(NULL,NULL);
if(hRC) {
wglDeleteContext(hRC);
hRC = NULL;
}
if(hDC) {
ReleaseDC(hWnd,hDC);
hDC = NULL;
}
hWnd = NULL;
initDone = false;
quadTextureSize = 0;
filterScale = 0;
afterRenderWidth = 0;
afterRenderHeight = 0;
shaderFunctionsLoaded = false;
shaderCompiled = false;
}
void COpenGL::CreateDrawSurface()
{
unsigned int neededSize;
HRESULT hr;
//we need at least 512 pixels (SNES_WIDTH * 2) so we can start with that value
quadTextureSize = 512;
neededSize = SNES_WIDTH * filterScale;
while(quadTextureSize < neededSize)
quadTextureSize *=2;
if(!drawTexture) {
glGenTextures(1,&drawTexture);
glBindTexture(GL_TEXTURE_2D,drawTexture);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,quadTextureSize,quadTextureSize,0,GL_RGB,GL_UNSIGNED_SHORT_5_6_5,NULL);
if(pboFunctionsLoaded) {
glGenBuffers(1,&drawBuffer);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER,drawBuffer);
glBufferData(GL_PIXEL_UNPACK_BUFFER,quadTextureSize*quadTextureSize*2,NULL,GL_STREAM_DRAW);
} else {
noPboBuffer = new BYTE[quadTextureSize*quadTextureSize*2];
}
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
ApplyDisplayChanges();
}
void COpenGL::DestroyDrawSurface()
{
if(drawTexture) {
glDeleteTextures(1,&drawTexture);
drawTexture = NULL;
}
if(drawBuffer) {
glDeleteBuffers(1,&drawBuffer);
drawBuffer = NULL;
}
if(noPboBuffer) {
delete [] noPboBuffer;
noPboBuffer = NULL;
}
}
bool COpenGL::ChangeDrawSurfaceSize(unsigned int scale)
{
filterScale = scale;
DestroyDrawSurface();
CreateDrawSurface();
SetupVertices();
return true;
}
void COpenGL::SetupVertices()
{
vertices[0] = 0.0f;
vertices[1] = 0.0f;
vertices[2] = 1.0f;
vertices[3] = 0.0f;
vertices[4] = 1.0f;
vertices[5] = 1.0f;
vertices[6] = 0.0f;
vertices[7] = 1.0f;
float tX = (float)afterRenderWidth / (float)quadTextureSize;
float tY = (float)afterRenderHeight / (float)quadTextureSize;
texcoords[0] = 0.0f;
texcoords[1] = tY;
texcoords[2] = tX;
texcoords[3] = tY;
texcoords[4] = tX;
texcoords[5] = 0.0f;
texcoords[6] = 0.0f;
texcoords[7] = 0.0f;
}
void COpenGL::Render(SSurface Src)
{
SSurface Dst;
RECT dstRect;
unsigned int newFilterScale;
GLenum error;
if(!initDone) return;
//create a new draw surface if the filter scale changes
//at least factor 2 so we can display unscaled hi-res images
newFilterScale = max(2,max(GetFilterScale(GUI.ScaleHiRes),GetFilterScale(GUI.Scale)));
if(newFilterScale!=filterScale) {
ChangeDrawSurfaceSize(newFilterScale);
}
if(pboFunctionsLoaded) {
Dst.Surface = (unsigned char *)glMapBuffer(GL_PIXEL_UNPACK_BUFFER,GL_WRITE_ONLY);
} else {
Dst.Surface = noPboBuffer;
}
Dst.Height = quadTextureSize;
Dst.Width = quadTextureSize;
Dst.Pitch = quadTextureSize * 2;
RenderMethod (Src, Dst, &dstRect);
if(!Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
S9xDisplayMessages ((uint16*)Dst.Surface, Dst.Pitch/2, dstRect.right-dstRect.left, dstRect.bottom-dstRect.top, GetFilterScale(CurrentScale));
}
if(pboFunctionsLoaded)
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
if(afterRenderHeight != dstRect.bottom || afterRenderWidth != dstRect.right) {
afterRenderHeight = dstRect.bottom;
afterRenderWidth = dstRect.right;
ApplyDisplayChanges();
}
if (shaderCompiled) {
GLint location;
float inputSize[2] = { (float)afterRenderWidth, (float)afterRenderHeight };
location = glGetUniformLocation (shaderProgram, "rubyInputSize");
glUniform2fv (location, 1, inputSize);
RECT windowSize;
GetClientRect(hWnd,&windowSize);
float outputSize[2] = {(float)(GUI.Stretch?windowSize.right:afterRenderWidth),
(float)(GUI.Stretch?windowSize.bottom:afterRenderHeight) };
location = glGetUniformLocation (shaderProgram, "rubyOutputSize");
glUniform2fv (location, 1, outputSize);
float textureSize[2] = { (float)quadTextureSize, (float)quadTextureSize };
location = glGetUniformLocation (shaderProgram, "rubyTextureSize");
glUniform2fv (location, 1, textureSize);
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, quadTextureSize);
glTexSubImage2D (GL_TEXTURE_2D,0,0,0,dstRect.right-dstRect.left,dstRect.bottom-dstRect.top,GL_RGB,GL_UNSIGNED_SHORT_5_6_5,pboFunctionsLoaded?0:noPboBuffer);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays (GL_QUADS, 0, 4);
glFlush();
SwapBuffers(hDC);
}
bool COpenGL::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
{
RECT displayRect=CalculateDisplayRect(afterRenderWidth,afterRenderHeight,newWidth,newHeight);
glViewport(displayRect.left,newHeight-displayRect.bottom,displayRect.right-displayRect.left,displayRect.bottom-displayRect.top);
SetupVertices();
return true;
}
bool COpenGL::ApplyDisplayChanges(void)
{
if(GUI.BilinearFilter) {
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
if(wglSwapIntervalEXT) {
wglSwapIntervalEXT(GUI.Vsync?1:0);
}
if(GUI.shaderEnabled && GUI.GLSLshaderFileName)
SetShaders(GUI.GLSLshaderFileName);
else
SetShaders(NULL);
RECT windowSize;
GetClientRect(hWnd,&windowSize);
ChangeRenderSize(windowSize.right,windowSize.bottom);
SetupVertices();
return true;
}
bool COpenGL::SetFullscreen(bool fullscreen)
{
if(!initDone)
return false;
if(this->fullscreen==fullscreen)
return true;
this->fullscreen = fullscreen;
if(fullscreen) {
DEVMODE dmScreenSettings={0};
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = GUI.FullscreenMode.width;
dmScreenSettings.dmPelsHeight = GUI.FullscreenMode.height;
dmScreenSettings.dmBitsPerPel = GUI.FullscreenMode.depth;
dmScreenSettings.dmDisplayFrequency = GUI.FullscreenMode.rate;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT|DM_DISPLAYFREQUENCY;
if(ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) {
this->fullscreen = false;
return false;
}
ChangeRenderSize(GUI.FullscreenMode.width,GUI.FullscreenMode.height);
} else {
ChangeDisplaySettings(NULL,0);
}
return true;
}
void COpenGL::SetSnes9xColorFormat()
{
GUI.ScreenDepth = 16;
GUI.BlueShift = 0;
GUI.GreenShift = 6;
GUI.RedShift = 11;
S9xSetRenderPixelFormat (RGB565);
S9xBlit2xSaIFilterInit();
S9xBlitHQ2xFilterInit();
GUI.NeedDepthConvert = FALSE;
GUI.DepthConverted = TRUE;
return;
}
void COpenGL::EnumModes(std::vector<dMode> *modeVector)
{
DISPLAY_DEVICE dd;
dd.cb = sizeof(dd);
DWORD dev = 0;
int iMode = 0;
dMode mode;
while (EnumDisplayDevices(0, dev, &dd, 0))
{
if (!(dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) && (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE))
{
DEVMODE dm;
ZeroMemory(&dm, sizeof(dm));
dm.dmSize = sizeof(dm);
iMode = 0;
while(EnumDisplaySettings(dd.DeviceName,iMode,&dm)) {
if(dm.dmBitsPerPel>=16) {
mode.width = dm.dmPelsWidth;
mode.height = dm.dmPelsHeight;
mode.rate = dm.dmDisplayFrequency;
mode.depth = dm.dmBitsPerPel;
modeVector->push_back(mode);
}
iMode++;
}
}
dev++;
}
}
bool COpenGL::LoadPBOFunctions()
{
if(pboFunctionsLoaded)
return true;
const char *extensions = (const char *) glGetString(GL_EXTENSIONS);
if(extensions && strstr(extensions, "pixel_buffer_object")) {
glGenBuffers = (PFNGLGENBUFFERSPROC)wglGetProcAddress("glGenBuffers");
glBindBuffer = (PFNGLBINDBUFFERPROC)wglGetProcAddress("glBindBuffer");
glBufferData = (PFNGLBUFFERDATAPROC)wglGetProcAddress("glBufferData");
glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)wglGetProcAddress("glDeleteBuffers");
glMapBuffer = (PFNGLMAPBUFFERPROC)wglGetProcAddress("glMapBuffer");
glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)wglGetProcAddress("glUnmapBuffer");
if(glGenBuffers && glBindBuffer && glBufferData && glDeleteBuffers && glMapBuffer) {
pboFunctionsLoaded = true;
}
}
return pboFunctionsLoaded;
}
bool COpenGL::LoadShaderFunctions()
{
if(shaderFunctionsLoaded)
return true;
const char *extensions = (const char *) glGetString(GL_EXTENSIONS);
if(extensions && strstr(extensions, "fragment_program")) {
glCreateProgram = (PFNGLCREATEPROGRAMPROC) wglGetProcAddress ("glCreateProgram");
glCreateShader = (PFNGLCREATESHADERPROC) wglGetProcAddress ("glCreateShader");
glCompileShader = (PFNGLCOMPILESHADERPROC) wglGetProcAddress ("glCompileShader");
glDeleteShader = (PFNGLDELETESHADERPROC) wglGetProcAddress ("glDeleteShader");
glDeleteProgram = (PFNGLDELETEPROGRAMPROC) wglGetProcAddress ("glDeleteProgram");
glAttachShader = (PFNGLATTACHSHADERPROC) wglGetProcAddress ("glAttachShader");
glDetachShader = (PFNGLDETACHSHADERPROC) wglGetProcAddress ("glDetachShader");
glLinkProgram = (PFNGLLINKPROGRAMPROC) wglGetProcAddress ("glLinkProgram");
glUseProgram = (PFNGLUSEPROGRAMPROC) wglGetProcAddress ("glUseProgram");
glShaderSource = (PFNGLSHADERSOURCEPROC) wglGetProcAddress ("glShaderSource");
glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) wglGetProcAddress ("glGetUniformLocation");
glUniform2fv = (PFNGLUNIFORM2FVPROC) wglGetProcAddress ("glUniform2fv");
if(glCreateProgram &&
glCreateShader &&
glCompileShader &&
glDeleteShader &&
glDeleteProgram &&
glAttachShader &&
glDetachShader &&
glLinkProgram &&
glUseProgram &&
glShaderSource &&
glGetUniformLocation &&
glUniform2fv) {
shaderFunctionsLoaded = true;
}
}
return shaderFunctionsLoaded;
}
char *ReadFileContents(const TCHAR *filename)
{
HANDLE hFile;
DWORD size;
DWORD bytesRead;
char *contents;
hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN , 0);
if(hFile == INVALID_HANDLE_VALUE){
return NULL;
}
size = GetFileSize(hFile,NULL);
contents = new char[size+1];
if(!ReadFile(hFile,contents,size,&bytesRead,NULL)) {
CloseHandle(hFile);
delete[] contents;
return NULL;
}
CloseHandle(hFile);
contents[size] = '\0';
return contents;
}
bool COpenGL::SetShaders(const TCHAR *glslFileName)
{
char *fragment=NULL, *vertex=NULL;
IXMLDOMDocument * pXMLDoc = NULL;
IXMLDOMElement * pXDE = NULL;
IXMLDOMNode * pXDN = NULL;
HRESULT hr;
BSTR queryString, nodeContent;
TCHAR errorMsg[MAX_PATH + 50];
shaderCompiled = false;
if(fragmentShader) {
glDetachShader(shaderProgram,fragmentShader);
glDeleteShader(fragmentShader);
fragmentShader = 0;
}
if(vertexShader) {
glDetachShader(shaderProgram,vertexShader);
glDeleteShader(vertexShader);
vertexShader = 0;
}
if(shaderProgram) {
glUseProgram(0);
glDeleteProgram(shaderProgram);
shaderProgram = 0;
}
if(glslFileName==NULL || *glslFileName==TEXT('\0'))
return true;
if(!LoadShaderFunctions()) {
MessageBox(NULL, TEXT("Unable to load OpenGL shader functions"), TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION);
return false;
}
hr = CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pXMLDoc));
if(FAILED(hr)) {
MessageBox(NULL, TEXT("Error creating XML Parser"), TEXT("Shader Loading Error"),
MB_OK|MB_ICONEXCLAMATION);
return false;
}
VARIANT fileName;
VARIANT_BOOL ret;
fileName.vt = VT_BSTR;
#ifdef UNICODE
fileName.bstrVal = SysAllocString(glslFileName);
#else
wchar_t tempfilename[MAX_PATH];
MultiByteToWideChar(CP_UTF8,0,glslFileName,-1,tempfilename,MAX_PATH);
fileName.bstrVal = SysAllocString(tempfilename);
#endif
hr = pXMLDoc->load(fileName,&ret);
SysFreeString(fileName.bstrVal);
if(FAILED(hr) || hr==S_FALSE) {
_stprintf(errorMsg,TEXT("Error loading GLSL shader file:\n%s"),glslFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
}
VARIANT attributeValue;
BSTR attributeName;
hr = pXMLDoc->get_documentElement(&pXDE);
if(FAILED(hr) || hr==S_FALSE) {
_stprintf(errorMsg,TEXT("Error loading root element from file:\n%s"),glslFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
pXMLDoc->Release();
return false;
}
attributeName=SysAllocString(L"language");
pXDE->getAttribute(attributeName,&attributeValue);
SysFreeString(attributeName);
pXDE->Release();
if(attributeValue.vt!=VT_BSTR || lstrcmpiW(attributeValue.bstrVal,L"glsl")) {
_stprintf(errorMsg,TEXT("Shader language is <%s>, expected <GLSL> in file:\n%s"),attributeValue.bstrVal,glslFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
pXMLDoc->Release();
return false;
}
if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
queryString=SysAllocString(L"/shader/fragment");
hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
SysFreeString(queryString);
if(hr == S_OK) {
hr = pXDN->get_text(&nodeContent);
if(hr == S_OK) {
int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,fragment,0,NULL,NULL);
fragment = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,fragment,requiredChars,NULL,NULL);
}
SysFreeString(nodeContent);
pXDN->Release();
pXDN = NULL;
}
queryString=SysAllocString(L"/shader/vertex");
hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
SysFreeString(queryString);
if(hr == S_OK) {
hr = pXDN->get_text(&nodeContent);
if(hr == S_OK) {
int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,vertex,0,NULL,NULL);
vertex = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,vertex,requiredChars,NULL,NULL);
}
SysFreeString(nodeContent);
pXDN->Release();
pXDN = NULL;
}
pXMLDoc->Release();
if(!fragment && !vertex) {
_stprintf(errorMsg,TEXT("No vertex or fragment program in file:\n%s"),glslFileName);
MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
return false;
}
shaderProgram = glCreateProgram ();
if(vertex) {
vertexShader = glCreateShader (GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, (const GLchar **)&vertex, NULL);
glCompileShader(vertexShader);
glAttachShader(shaderProgram, vertexShader);
delete[] vertex;
}
if(fragment) {
fragmentShader = glCreateShader (GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, (const GLchar **)&fragment, NULL);
glCompileShader(fragmentShader);
glAttachShader(shaderProgram, fragmentShader);
delete[] fragment;
}
glLinkProgram(shaderProgram);
glUseProgram(shaderProgram);
shaderCompiled = true;
return true;
}

265
win32/COpenGL.h Normal file
View File

@ -0,0 +1,265 @@
/***********************************************************************************
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
Jerremy Koot (jkoot@snes9x.com)
(c) Copyright 2002 - 2004 Matthew Kendora
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
Kris Bleakley (codeviolation@hotmail.com)
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso,
OV2
BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom,
zones
C4 x86 assembler and some C emulation code
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
Nach,
zsKnight (zsknight@zsnes.com)
C4 C++ code
(c) Copyright 2003 - 2006 Brad Jorsch,
Nach
DSP-1 emulator code
(c) Copyright 1998 - 2006 _Demo_,
Andreas Naive (andreasnaive@gmail.com),
Gary Henderson,
Ivar (ivar@snes9x.com),
John Weidman,
Kris Bleakley,
Matthew Kendora,
Nach,
neviksti (neviksti@hotmail.com)
DSP-2 emulator code
(c) Copyright 2003 John Weidman,
Kris Bleakley,
Lord Nightmare (lord_nightmare@users.sourceforge.net),
Matthew Kendora,
neviksti
DSP-3 emulator code
(c) Copyright 2003 - 2006 John Weidman,
Kris Bleakley,
Lancer,
z80 gaiden
DSP-4 emulator code
(c) Copyright 2004 - 2006 Dreamer Nom,
John Weidman,
Kris Bleakley,
Nach,
z80 gaiden
OBC1 emulator code
(c) Copyright 2001 - 2004 zsKnight,
pagefault (pagefault@zsnes.com),
Kris Bleakley
Ported from x86 assembler to C by sanmaiwashi
SPC7110 and RTC C++ emulator code used in 1.39-1.51
(c) Copyright 2002 Matthew Kendora with research by
zsKnight,
John Weidman,
Dark Force
SPC7110 and RTC C++ emulator code used in 1.52+
(c) Copyright 2009 byuu,
neviksti
S-DD1 C emulator code
(c) Copyright 2003 Brad Jorsch with research by
Andreas Naive,
John Weidman
S-RTC C emulator code
(c) Copyright 2001 - 2006 byuu,
John Weidman
ST010 C++ emulator code
(c) Copyright 2003 Feather,
John Weidman,
Kris Bleakley,
Matthew Kendora
Super FX x86 assembler emulator code
(c) Copyright 1998 - 2003 _Demo_,
pagefault,
zsKnight
Super FX C emulator code
(c) Copyright 1997 - 1999 Ivar,
Gary Henderson,
John Weidman
Sound emulator code used in 1.5-1.51
(c) Copyright 1998 - 2003 Brad Martin
(c) Copyright 1998 - 2006 Charles Bilyue'
Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
2xSaI filter
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
HQ2x, HQ3x, HQ4x filters
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
NTSC filter
(c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso
Win32 GUI code
(c) Copyright 2003 - 2006 blip,
funkyass,
Matthew Kendora,
Nach,
nitsuja
(c) Copyright 2009 - 2010 OV2
Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones
Specific ports contains the works of other authors. See headers in
individual files.
Snes9x homepage: http://www.snes9x.com/
Permission to use, copy, modify and/or distribute Snes9x in both binary
and source form, for non-commercial purposes, is hereby granted without
fee, providing that this license information and copyright notice appear
with all copies and any derived work.
This software is provided 'as-is', without any express or implied
warranty. In no event shall the authors be held liable for any damages
arising from the use of this software or it's derivatives.
Snes9x is freeware for PERSONAL USE only. Commercial users should
seek permission of the copyright holders first. Commercial use includes,
but is not limited to, charging money for Snes9x or software derived from
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
using Snes9x as a promotion for your commercial product.
The copyright holders request that bug fixes and improvements to the code
should be forwarded to them so everyone can benefit from the modifications
in future versions.
Super NES and Super Nintendo Entertainment System are trademarks of
Nintendo Co., Limited and its subsidiary companies.
***********************************************************************************/
#ifndef COPENGL_H
#define COPENGL_H
#include <windows.h>
#include <gl\gl.h>
#include "glext.h"
#include "wglext.h"
#include "IS9xDisplayOutput.h"
/* IS9xDisplayOutput
Interface for display driver.
*/
class COpenGL : public IS9xDisplayOutput
{
private:
HDC hDC;
HGLRC hRC;
HWND hWnd;
GLuint drawTexture;
GLuint drawBuffer;
GLfloat vertices[8];
GLfloat texcoords[8];
unsigned char * noPboBuffer;
bool initDone;
bool fullscreen;
unsigned int quadTextureSize;
unsigned int filterScale;
unsigned int afterRenderWidth, afterRenderHeight;
bool shaderFunctionsLoaded;
bool shaderCompiled;
bool pboFunctionsLoaded;
GLuint shaderProgram;
GLuint vertexShader;
GLuint fragmentShader;
// PBO Functions
PFNGLGENBUFFERSPROC glGenBuffers;
PFNGLBINDBUFFERPROC glBindBuffer;
PFNGLBUFFERDATAPROC glBufferData;
PFNGLDELETEBUFFERSPROC glDeleteBuffers;
PFNGLMAPBUFFERPROC glMapBuffer;
PFNGLUNMAPBUFFERPROC glUnmapBuffer;
// Shader Functions
PFNGLCREATEPROGRAMPROC glCreateProgram;
PFNGLCREATESHADERPROC glCreateShader;
PFNGLCOMPILESHADERPROC glCompileShader;
PFNGLDELETESHADERPROC glDeleteShader;
PFNGLDELETEPROGRAMPROC glDeleteProgram;
PFNGLATTACHSHADERPROC glAttachShader;
PFNGLDETACHSHADERPROC glDetachShader;
PFNGLLINKPROGRAMPROC glLinkProgram;
PFNGLUSEPROGRAMPROC glUseProgram;
PFNGLSHADERSOURCEPROC glShaderSource;
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
PFNGLUNIFORM2FVPROC glUniform2fv;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
bool SetShaders(const TCHAR *glslFileName);
bool LoadShaderFunctions();
bool LoadPBOFunctions();
void CreateDrawSurface(void);
void DestroyDrawSurface(void);
bool ChangeDrawSurfaceSize(unsigned int scale);
void SetupVertices();
public:
COpenGL();
~COpenGL();
bool Initialize(HWND hWnd);
void DeInitialize();
void Render(SSurface Src);
bool ChangeRenderSize(unsigned int newWidth, unsigned int newHeight);
bool ApplyDisplayChanges(void);
bool SetFullscreen(bool fullscreen);
void SetSnes9xColorFormat(void);
void EnumModes(std::vector<dMode> *modeVector);
};
#endif

View File

@ -225,7 +225,7 @@ bool CXAudio2::InitXAudio2(void)
MessageBox (GUI.hWnd, TEXT("\ MessageBox (GUI.hWnd, TEXT("\
Unable to initialize XAudio2. You will not be able to hear any\n\ Unable to initialize XAudio2. You will not be able to hear any\n\
sound effects or music while playing.\n\n\ sound effects or music while playing.\n\n\
It is usually caused by not having a recent DirectX release installed."), This is usually caused by not having a recent DirectX release installed."),
TEXT("Snes9X - Unable to Initialize XAudio2"), TEXT("Snes9X - Unable to Initialize XAudio2"),
MB_OK | MB_ICONWARNING); MB_OK | MB_ICONWARNING);
return false; return false;

View File

@ -180,6 +180,7 @@
#define IS9XDISPLAYOUTPUT_H #define IS9XDISPLAYOUTPUT_H
#include "../port.h" #include "../port.h"
#include "render.h" #include "render.h"
#include "wsnes9x.h"
#include <vector> #include <vector>
/* IS9xDisplayOutput /* IS9xDisplayOutput

View File

@ -184,7 +184,6 @@
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#include <tchar.h>
#include <io.h> #include <io.h>
#if (((defined(_MSC_VER) && _MSC_VER >= 1300)) || defined(__MINGW32__)) #if (((defined(_MSC_VER) && _MSC_VER >= 1300)) || defined(__MINGW32__))
@ -889,7 +888,7 @@ static LRESULT CALLBACK InputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
{ {
// retrieve the custom structure POINTER for THIS window // retrieve the custom structure POINTER for THIS window
InputCust *icp = GetInputCustom(hwnd); InputCust *icp = GetInputCustom(hwnd);
HWND pappy = (HWND__ *)GetWindowLongPtr(hwnd,GWL_HWNDPARENT); HWND pappy = (HWND__ *)GetWindowLongPtr(hwnd,GWLP_HWNDPARENT);
funky= hwnd; funky= hwnd;
static HWND selectedItem = NULL; static HWND selectedItem = NULL;
@ -950,7 +949,7 @@ static LRESULT CALLBACK InputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
icp->crForeGnd = ((~col) & 0x00ffffff); icp->crForeGnd = ((~col) & 0x00ffffff);
icp->crBackGnd = col; icp->crBackGnd = col;
SetWindowText(hwnd,temp); SetWindowText(hwnd,_tFromChar(temp));
InvalidateRect(icp->hwnd, NULL, FALSE); InvalidateRect(icp->hwnd, NULL, FALSE);
UpdateWindow(icp->hwnd); UpdateWindow(icp->hwnd);
SendMessage(pappy,WM_USER+43,wParam,(LPARAM)hwnd); SendMessage(pappy,WM_USER+43,wParam,(LPARAM)hwnd);
@ -969,7 +968,7 @@ static LRESULT CALLBACK InputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
} }
icp->crForeGnd = ((~col) & 0x00ffffff); icp->crForeGnd = ((~col) & 0x00ffffff);
icp->crBackGnd = col; icp->crBackGnd = col;
SetWindowText(hwnd,temp); SetWindowText(hwnd,_tFromChar(temp));
InvalidateRect(icp->hwnd, NULL, FALSE); InvalidateRect(icp->hwnd, NULL, FALSE);
UpdateWindow(icp->hwnd); UpdateWindow(icp->hwnd);
@ -1071,7 +1070,7 @@ static LRESULT CALLBACK HotInputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam
{ {
// retrieve the custom structure POINTER for THIS window // retrieve the custom structure POINTER for THIS window
InputCust *icp = GetInputCustom(hwnd); InputCust *icp = GetInputCustom(hwnd);
HWND pappy = (HWND__ *)GetWindowLongPtr(hwnd,GWL_HWNDPARENT); HWND pappy = (HWND__ *)GetWindowLongPtr(hwnd,GWLP_HWNDPARENT);
funky= hwnd; funky= hwnd;
static HWND selectedItem = NULL; static HWND selectedItem = NULL;
@ -1200,7 +1199,7 @@ static LRESULT CALLBACK HotInputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam
icp->crForeGnd = ((~col) & 0x00ffffff); icp->crForeGnd = ((~col) & 0x00ffffff);
icp->crBackGnd = col; icp->crBackGnd = col;
SetWindowText(hwnd,temp); SetWindowText(hwnd,_tFromChar(temp));
InvalidateRect(icp->hwnd, NULL, FALSE); InvalidateRect(icp->hwnd, NULL, FALSE);
UpdateWindow(icp->hwnd); UpdateWindow(icp->hwnd);
SendMessage(pappy,WM_USER+43,wParam,(LPARAM)hwnd); SendMessage(pappy,WM_USER+43,wParam,(LPARAM)hwnd);
@ -1237,7 +1236,7 @@ static LRESULT CALLBACK HotInputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam
icp->crForeGnd = ((~col) & 0x00ffffff); icp->crForeGnd = ((~col) & 0x00ffffff);
icp->crBackGnd = col; icp->crBackGnd = col;
SetWindowText(hwnd,temp); SetWindowText(hwnd,_tFromChar(temp));
InvalidateRect(icp->hwnd, NULL, FALSE); InvalidateRect(icp->hwnd, NULL, FALSE);
UpdateWindow(icp->hwnd); UpdateWindow(icp->hwnd);
SendMessage(pappy,WM_USER+43,wParam,(LPARAM)hwnd); SendMessage(pappy,WM_USER+43,wParam,(LPARAM)hwnd);
@ -1265,7 +1264,7 @@ static LRESULT CALLBACK HotInputCustomWndProc(HWND hwnd, UINT msg, WPARAM wParam
} }
icp->crForeGnd = ((~col) & 0x00ffffff); icp->crForeGnd = ((~col) & 0x00ffffff);
icp->crBackGnd = col; icp->crBackGnd = col;
SetWindowText(hwnd,temp); SetWindowText(hwnd,_tFromChar(temp));
InvalidateRect(icp->hwnd, NULL, FALSE); InvalidateRect(icp->hwnd, NULL, FALSE);
UpdateWindow(icp->hwnd); UpdateWindow(icp->hwnd);
} }

28
win32/_tfwopen.cpp Normal file
View File

@ -0,0 +1,28 @@
#ifdef UNICODE
#include <windows.h>
#include "_tfwopen.h"
Utf8ToWide::Utf8ToWide(const char *utf8Chars) {
int requiredChars = MultiByteToWideChar(CP_UTF8,0,utf8Chars,-1,wideChars,0);
wideChars = new wchar_t[requiredChars];
MultiByteToWideChar(CP_UTF8,0,utf8Chars,-1,wideChars,requiredChars);
}
WideToUtf8::WideToUtf8(const wchar_t *wideChars) {
int requiredChars = WideCharToMultiByte(CP_UTF8,0,wideChars,-1,utf8Chars,0,NULL,NULL);
utf8Chars = new char[requiredChars];
WideCharToMultiByte(CP_UTF8,0,wideChars,-1,utf8Chars,requiredChars,NULL,NULL);
}
extern "C" FILE *_tfwopen(const char *filename, const char *mode ) {
wchar_t mode_w[30];
lstrcpyn(mode_w,Utf8ToWide(mode),29);
mode_w[29]=L'\0';
return _wfopen(Utf8ToWide(filename),mode_w);
}
extern "C" int _twremove(const char *filename ) {
return _wremove(Utf8ToWide(filename));
}
#endif // UNICODE

84
win32/_tfwopen.h Normal file
View File

@ -0,0 +1,84 @@
#ifdef UNICODE
#ifndef _TFWOPEN_H
#define _TFWOPEN_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
FILE *_tfwopen(const char *filename, const char *mode );
int _twremove(const char *filename );
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#include <fstream>
class Utf8ToWide {
private:
wchar_t *wideChars;
public:
Utf8ToWide(const char *utf8Chars);
~Utf8ToWide() { delete [] wideChars; }
operator wchar_t *() { return wideChars; }
};
class WideToUtf8 {
private:
char *utf8Chars;
public:
WideToUtf8(const wchar_t *wideChars);
~WideToUtf8() { delete [] utf8Chars; }
operator char *() { return utf8Chars; }
};
namespace std {
class u8nifstream: public std::ifstream
{
public:
void __CLR_OR_THIS_CALL open(const char *_Filename, ios_base::open_mode _Mode)
{
std::ifstream::open(Utf8ToWide(_Filename), (ios_base::openmode)_Mode);
}
void __CLR_OR_THIS_CALL open(const wchar_t *_Filename, ios_base::open_mode _Mode)
{
std::ifstream::open(_Filename, (ios_base::openmode)_Mode);
}
__CLR_OR_THIS_CALL u8nifstream()
: std::ifstream() {}
explicit __CLR_OR_THIS_CALL u8nifstream(const char *_Filename,
ios_base::openmode _Mode = ios_base::in,
int _Prot = (int)ios_base::_Openprot)
: std::ifstream(Utf8ToWide(_Filename),_Mode) {}
explicit __CLR_OR_THIS_CALL u8nifstream(const wchar_t *_Filename,
ios_base::openmode _Mode = ios_base::in,
int _Prot = (int)ios_base::_Openprot)
: std::ifstream(_Filename,_Mode,_Prot) {}
#ifdef _NATIVE_WCHAR_T_DEFINED
explicit __CLR_OR_THIS_CALL u8nifstream(const unsigned short *_Filename,
ios_base::openmode _Mode = ios_base::in,
int _Prot = (int)ios_base::_Openprot)
: std::ifstream(_Filename,_Mode,_Prot) {}
#endif /* _NATIVE_WCHAR_T_DEFINED */
explicit __CLR_OR_THIS_CALL u8nifstream(_Filet *_File)
: std::ifstream(_File) {}
};
}
#define ifstream u8nifstream
#endif // __cplusplus
#define fopen _tfwopen
#define remove _twremove
#endif
#endif // _TFWOPEN_H

View File

@ -1,8 +1,11 @@
Various software and tools are required to compile Snes9x on Windows: Various software and tools are required to compile Snes9x on Windows:
NOTE: Unicode support requires a special zlib build - see the end of the zlib entry
- Microsoft Visual C++ 7.1 or Microsoft Visual C++ 6.0 SP5 with the - Microsoft Visual C++ 7.1 or Microsoft Visual C++ 6.0 SP5 with the
latest Platform SDK, to compile all the C++ source code. latest Platform SDK, to compile all the C++ source code.
The current official binary is compiled with Visual Studio 2008 The current official binary is compiled with Visual Studio 2008, you'll have to create
your own project file for earlier MSVC versions
- A recent DirectX SDK. The official binary is compiled against the June 2008 SDK. - A recent DirectX SDK. The official binary is compiled against the June 2008 SDK.
@ -16,6 +19,9 @@ Various software and tools are required to compile Snes9x on Windows:
listing will disable zip support. listing will disable zip support.
(the zlib directory should reside at win32/../../zlib, i.e. 2 directories up, the (the zlib directory should reside at win32/../../zlib, i.e. 2 directories up, the
lib file is expected in win32/../../zlib/lib) lib file is expected in win32/../../zlib/lib)
If you want to build snes9x with unicode support you can use the project file in win32\zlib
to compile zlib - if you want to use the project files supplied with zlib you have to add
_tfwopen.h to their force include list
- libpng(optional) - Like zlib, this is a renamed libpng.lib, built against the same - libpng(optional) - Like zlib, this is a renamed libpng.lib, built against the same
C runtime for the same reasons. Building your own is as simple as changing the runtime C runtime for the same reasons. Building your own is as simple as changing the runtime

10081
win32/glext.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -373,6 +373,7 @@ inline static bool GetFilter32BitSupport(RenderFilter filterID)
case FILTER_SCANLINES: case FILTER_SCANLINES:
case FILTER_TVMODE3X: case FILTER_TVMODE3X:
case FILTER_DOTMATRIX3X: case FILTER_DOTMATRIX3X:
case FILTER_SIMPLE4X:
return true; return true;
default: default:
@ -388,11 +389,9 @@ void SelectRenderMethod()
RenderMethod = FilterToMethod(GUI.Scale); RenderMethod = FilterToMethod(GUI.Scale);
RenderMethodHiRes = FilterToMethod(GUI.ScaleHiRes); RenderMethodHiRes = FilterToMethod(GUI.ScaleHiRes);
if (GUI.ScreenCleared || OldRenderMethod != RenderMethod || OldRenderMethodHiRes != RenderMethodHiRes) if (OldRenderMethod != RenderMethod || OldRenderMethodHiRes != RenderMethodHiRes)
snes9x_clear_change_log = GUI.NumFlipFrames; snes9x_clear_change_log = GUI.NumFlipFrames;
GUI.ScreenCleared = false;
GUI.DepthConverted = !GUI.NeedDepthConvert; GUI.DepthConverted = !GUI.NeedDepthConvert;
if(GUI.ScreenDepth == 32 && if(GUI.ScreenDepth == 32 &&
((GetFilter32BitSupport(GUI.Scale) && (IPPU.RenderedScreenHeight <= SNES_HEIGHT_EXTENDED && IPPU.RenderedScreenWidth < 512)) || ((GetFilter32BitSupport(GUI.Scale) && (IPPU.RenderedScreenHeight <= SNES_HEIGHT_EXTENDED && IPPU.RenderedScreenWidth < 512)) ||

View File

@ -55,7 +55,6 @@
#define IDC_MUTE 1016 #define IDC_MUTE 1016
#define IDC_SKIP_TYPE 1017 #define IDC_SKIP_TYPE 1017
#define IDC_SCROLLBAR1 1018 #define IDC_SCROLLBAR1 1018
#define IDC_FMUT 1018
#define IDC_VRAM_DISPLAY 1019 #define IDC_VRAM_DISPLAY 1019
#define IDC_WIP1 1019 #define IDC_WIP1 1019
#define IDC_ADDRESS 1020 #define IDC_ADDRESS 1020
@ -93,6 +92,7 @@
#define IDC_MOVIE_METADATA 1090 #define IDC_MOVIE_METADATA 1090
#define IDC_MULTICART_EDITA 1090 #define IDC_MULTICART_EDITA 1090
#define IDC_INRATEEDIT 1090 #define IDC_INRATEEDIT 1090
#define IDC_SHADER_HLSL_FILE 1090
#define IDC_PAUSEINTERVAL 1091 #define IDC_PAUSEINTERVAL 1091
#define IDC_UPRIGHT 1091 #define IDC_UPRIGHT 1091
#define IDC_MULTICART_BIOSEDIT 1091 #define IDC_MULTICART_BIOSEDIT 1091
@ -101,6 +101,7 @@
#define IDC_MULTICART_EDITB 1092 #define IDC_MULTICART_EDITB 1092
#define IDC_PAUSESPIN 1093 #define IDC_PAUSESPIN 1093
#define IDC_DWNRIGHT 1093 #define IDC_DWNRIGHT 1093
#define IDC_SHADER_GLSL_FILE 1093
#define IDC_SYNCBYRESET 1094 #define IDC_SYNCBYRESET 1094
#define IDC_DOWN 1094 #define IDC_DOWN 1094
#define IDC_SENDROM 1095 #define IDC_SENDROM 1095
@ -145,6 +146,7 @@
#define IDC_CLEAR_CHEATS 1126 #define IDC_CLEAR_CHEATS 1126
#define IDC_JPTOGGLE 1126 #define IDC_JPTOGGLE 1126
#define IDC_LOCALVIDMEM 1126 #define IDC_LOCALVIDMEM 1126
#define IDC_VSYNC 1126
#define IDC_CHEAT_DESCRIPTION 1127 #define IDC_CHEAT_DESCRIPTION 1127
#define IDC_KEYBOARD 1127 #define IDC_KEYBOARD 1127
#define IDC_ALLOWLEFTRIGHT 1127 #define IDC_ALLOWLEFTRIGHT 1127
@ -344,10 +346,13 @@
#define IDC_INRATETEXT 3012 #define IDC_INRATETEXT 3012
#define IDC_SPIN_MAX_SKIP_DISP 3013 #define IDC_SPIN_MAX_SKIP_DISP 3013
#define IDC_SPIN_MAX_SKIP_DISP_FIXED 3014 #define IDC_SPIN_MAX_SKIP_DISP_FIXED 3014
#define IDC_SHADER_ENABLED 3015
#define IDC_SHADER_HLSL_BROWSE 3016
#define IDC_SHADER_GROUP 3017
#define IDC_SHADER_GLSL_BROWSE 3018
#define ID_FILE_EXIT 40001 #define ID_FILE_EXIT 40001
#define ID_LANGUAGE_ENGLISH 40002
#define ID_LANGUAGE_NEDERLANDS 40003
#define ID_WINDOW_HIDEMENUBAR 40004 #define ID_WINDOW_HIDEMENUBAR 40004
#define ID_FILE_AVI_RECORDING 40005
#define ID_SOUND_NOSOUND 40021 #define ID_SOUND_NOSOUND 40021
#define ID_OPTIONS_JOYPAD 40022 #define ID_OPTIONS_JOYPAD 40022
#define ID_WINDOW_SHOWFPS 40023 #define ID_WINDOW_SHOWFPS 40023
@ -386,14 +391,13 @@
#define ID_CHEAT_ENTER 40063 #define ID_CHEAT_ENTER 40063
#define ID_CHEAT_SEARCH 40064 #define ID_CHEAT_SEARCH 40064
#define ID_CHEAT_APPLY 40065 #define ID_CHEAT_APPLY 40065
#define ID_FILE_SAVE_SPC_DATA 40066
#define ID_HELP_ABOUT 40067 #define ID_HELP_ABOUT 40067
#define ID_SOUND_OPTIONS 40068 #define ID_SOUND_OPTIONS 40068
#define ID_OPTIONS_EMULATION 40069 #define ID_OPTIONS_EMULATION 40069
#define ID_OPTIONS_SETTINGS 40070 #define ID_OPTIONS_SETTINGS 40070
#define ID_DEBUG_TRACE 40071 #define ID_DEBUG_TRACE 40071
#define ID_DEBUG_TRACE_SPC 40072 #define ID_FRAME_ADVANCE 40074
#define ID_DEBUG_TRACE_SA1 40073
#define ID_DEBUG_TRACE_DSP1 40074
#define ID_DEBUG_FRAME_ADVANCE 40075 #define ID_DEBUG_FRAME_ADVANCE 40075
#define ID_DEBUG_SNES_STATUS 40076 #define ID_DEBUG_SNES_STATUS 40076
#define ID_NETPLAY_SERVER 40077 #define ID_NETPLAY_SERVER 40077
@ -423,7 +427,6 @@
#define IDM_ENABLE_MULTITAP 40104 #define IDM_ENABLE_MULTITAP 40104
#define IDM_MOUSE_TOGGLE 40105 #define IDM_MOUSE_TOGGLE 40105
#define IDM_SCOPE_TOGGLE 40106 #define IDM_SCOPE_TOGGLE 40106
#define IDM_CATCH_UP_SOUND 40107
#define IDM_GFX_PACKS 40108 #define IDM_GFX_PACKS 40108
#define IDM_JUSTIFIER 40109 #define IDM_JUSTIFIER 40109
#define ID_SCREENSHOT 40110 #define ID_SCREENSHOT 40110
@ -435,7 +438,7 @@
#define ID_FILE_STOP_AVI 40117 #define ID_FILE_STOP_AVI 40117
#define ID_OPTIONS_KEYCUSTOM 40118 #define ID_OPTIONS_KEYCUSTOM 40118
#define ID_WINDOW_ 40119 #define ID_WINDOW_ 40119
#define ID_WINDOW_VIDMEM 40122 #define ID_WINDOW_BILINEAR 40122
#define ID_WINDOW_ASPECTRATIO 40123 #define ID_WINDOW_ASPECTRATIO 40123
#define ID_TURBO_LEFT 40124 #define ID_TURBO_LEFT 40124
#define ID_TURBO_UP 40125 #define ID_TURBO_UP 40125
@ -472,14 +475,20 @@
#define ID_SOUND_176MS 40164 #define ID_SOUND_176MS 40164
#define ID_SOUND_194MS 40165 #define ID_SOUND_194MS 40165
#define ID_SOUND_210MS 40166 #define ID_SOUND_210MS 40166
#define ID_EMULATION_PAUSEWHENINACTIVE 40167
#define ID_VIDEO_SHOWFRAMERATE 40168
#define ID_WINDOW_SIZE_1X 40169
#define ID_WINDOW_SIZE_2X 40170
#define ID_WINDOW_SIZE_3X 40171
#define ID_WINDOW_SIZE_4X 40172
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 151 #define _APS_NEXT_RESOURCE_VALUE 151
#define _APS_NEXT_COMMAND_VALUE 40154 #define _APS_NEXT_COMMAND_VALUE 40173
#define _APS_NEXT_CONTROL_VALUE 3014 #define _APS_NEXT_CONTROL_VALUE 3018
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -34,7 +34,7 @@ IDC_CURSOR_SCOPE CURSOR "nodrop.cur"
IDR_SNES9X_ACCELERATORS ACCELERATORS IDR_SNES9X_ACCELERATORS ACCELERATORS
BEGIN BEGIN
"E", ID_CHEAT_ENTER, VIRTKEY, ALT, NOINVERT "G", ID_CHEAT_ENTER, VIRTKEY, ALT, NOINVERT
"A", ID_CHEAT_SEARCH, VIRTKEY, ALT, NOINVERT "A", ID_CHEAT_SEARCH, VIRTKEY, ALT, NOINVERT
"O", ID_FILE_LOAD_GAME, VIRTKEY, CONTROL, NOINVERT "O", ID_FILE_LOAD_GAME, VIRTKEY, CONTROL, NOINVERT
VK_F5, ID_OPTIONS_DISPLAY, VIRTKEY, ALT, NOINVERT VK_F5, ID_OPTIONS_DISPLAY, VIRTKEY, ALT, NOINVERT
@ -81,14 +81,13 @@ BEGIN
LTEXT "Input Rate:",IDC_INRATETEXT,14,74,46,11 LTEXT "Input Rate:",IDC_INRATETEXT,14,74,46,11
END END
IDD_ROM_INFO DIALOG 0, 0, 233, 185 IDD_ROM_INFO DIALOGEX 0, 0, 233, 185
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
CAPTION "Rom Info" CAPTION "Rom Info"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,85,164,50,14 DEFPUSHBUTTON "OK",IDOK,85,164,50,14
EDITTEXT IDC_ROM_DATA,7,7,219,146,ES_MULTILINE | ES_READONLY EDITTEXT IDC_ROM_DATA,7,7,219,153,ES_MULTILINE | ES_READONLY
LTEXT "",IDC_WARNINGS,7,145,219,15,SS_CENTERIMAGE
END END
IDD_ABOUT DIALOGEX 0, 0, 232, 181 IDD_ABOUT DIALOGEX 0, 0, 232, 181
@ -174,14 +173,14 @@ BEGIN
CONTROL "Sync By Reset",IDC_SYNCBYRESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,90,174,15 CONTROL "Sync By Reset",IDC_SYNCBYRESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,90,174,15
END END
IDD_NEWDISPLAY DIALOGEX 0, 0, 353, 184 IDD_NEWDISPLAY DIALOGEX 0, 0, 353, 259
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION
CAPTION "Display Settings" CAPTION "Display Settings"
FONT 8, "MS Sans Serif", 0, 0, 0x1 FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,239,163,50,14 DEFPUSHBUTTON "OK",IDOK,239,237,50,14
PUSHBUTTON "Cancel",IDCANCEL,296,163,50,14 PUSHBUTTON "Cancel",IDCANCEL,296,237,50,14
COMBOBOX IDC_OUTPUTMETHOD,68,17,101,38,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_OUTPUTMETHOD,68,17,101,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,36,48,10 CONTROL "Fullscreen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,36,48,10
CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,75,10 CONTROL "Emulate Fullscreen",IDC_EMUFULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,47,75,10
CONTROL "Stretch Image",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,60,10 CONTROL "Stretch Image",IDC_STRETCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,60,10
@ -199,12 +198,16 @@ BEGIN
COMBOBOX IDC_FILTERBOX2,217,33,122,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERBOX2,217,33,122,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Resolution",IDC_CURRMODE,187,71,41,8 LTEXT "Resolution",IDC_CURRMODE,187,71,41,8
COMBOBOX IDC_RESOLUTION,234,69,105,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_RESOLUTION,234,69,105,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,85,87,10 CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,86,87,10
CONTROL "VSync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,300,86,37,10
CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,113,153,10 CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,113,153,10
CONTROL "Hi Resolution Support",IDC_HIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,124,85,10 CONTROL "Hi Resolution Support",IDC_HIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,124,85,10
CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,135,111,10 CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,135,111,10
CONTROL "Display messages before applying filters",IDC_MESSAGES_IN_IMAGE, CONTROL "Display messages before applying filters",IDC_MESSAGES_IN_IMAGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,140,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,140,10
GROUPBOX "",IDC_SHADER_GROUP,8,162,338,71,0,WS_EX_TRANSPARENT
EDITTEXT IDC_SHADER_HLSL_FILE,13,184,306,14,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "...",IDC_SHADER_HLSL_BROWSE,322,184,19,14,WS_DISABLED
GROUPBOX "Frame Skipping:",IDC_STATIC,7,113,167,46,0,WS_EX_TRANSPARENT GROUPBOX "Frame Skipping:",IDC_STATIC,7,113,167,46,0,WS_EX_TRANSPARENT
GROUPBOX "SNES Image",IDC_STATIC,180,103,166,57,0,WS_EX_TRANSPARENT GROUPBOX "SNES Image",IDC_STATIC,180,103,166,57,0,WS_EX_TRANSPARENT
GROUPBOX "Output Image Processing",IDC_STATIC,179,7,166,46,0,WS_EX_TRANSPARENT GROUPBOX "Output Image Processing",IDC_STATIC,179,7,166,46,0,WS_EX_TRANSPARENT
@ -214,6 +217,11 @@ BEGIN
LTEXT "Max skipped frames:",IDC_STATIC,62,126,67,8 LTEXT "Max skipped frames:",IDC_STATIC,62,126,67,8
LTEXT "Amount skipped:",IDC_STATIC,62,144,67,8 LTEXT "Amount skipped:",IDC_STATIC,62,144,67,8
LTEXT "Output Method",IDC_STATIC,10,19,51,11 LTEXT "Output Method",IDC_STATIC,10,19,51,11
CONTROL "Use Shader",IDC_SHADER_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,162,52,9
LTEXT "HLSL Effect File",IDC_STATIC,13,173,104,8
EDITTEXT IDC_SHADER_GLSL_FILE,13,213,306,14,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "...",IDC_SHADER_GLSL_BROWSE,322,213,19,14,WS_DISABLED
LTEXT "GLSL shader",IDC_STATIC,13,202,104,8
END END
IDD_CHEATER DIALOGEX 0, 0, 262, 218 IDD_CHEATER DIALOGEX 0, 0, 262, 218
@ -581,7 +589,7 @@ BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 346 RIGHTMARGIN, 346
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 177 BOTTOMMARGIN, 251
END END
IDD_CHEATER, DIALOG IDD_CHEATER, DIALOG
@ -693,18 +701,6 @@ IDB_HIDDENFOLDER BITMAP "hiddir.bmp"
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_ICON1 ICON "icon1.ico" IDI_ICON1 ICON "icon1.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Dutch (Netherlands) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLD)
#ifdef _WIN32
LANGUAGE LANG_DUTCH, SUBLANG_DUTCH
#pragma code_page(1252)
#endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -729,7 +725,7 @@ BEGIN
BLOCK "080904b0" BLOCK "080904b0"
BEGIN BEGIN
VALUE "CompanyName", "http://www.snes9x.com" VALUE "CompanyName", "http://www.snes9x.com"
VALUE "FileDescription", "Snes9XW" VALUE "FileDescription", "Snes9X"
VALUE "FileVersion", "1.52" VALUE "FileVersion", "1.52"
VALUE "InternalName", "Snes9X" VALUE "InternalName", "Snes9X"
VALUE "LegalCopyright", "Copyright 1996-2010" VALUE "LegalCopyright", "Copyright 1996-2010"
@ -769,19 +765,6 @@ END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#endif // Dutch (Netherlands) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Dialog // Dialog
@ -819,50 +802,52 @@ BEGIN
POPUP "&Save Game Position" POPUP "&Save Game Position"
BEGIN BEGIN
MENUITEM "Slot #&1", ID_FILE_SAVE1 MENUITEM "Slot #&1", ID_FILE_SAVE1
MENUITEM "Slot #&2", ID_FILE_SAVE2, GRAYED MENUITEM "Slot #&2", ID_FILE_SAVE2
MENUITEM "Slot #&3", ID_FILE_SAVE3, GRAYED MENUITEM "Slot #&3", ID_FILE_SAVE3
MENUITEM "Slot #&4", ID_FILE_SAVE4, GRAYED MENUITEM "Slot #&4", ID_FILE_SAVE4
MENUITEM "Slot #&5", ID_FILE_SAVE5, GRAYED MENUITEM "Slot #&5", ID_FILE_SAVE5
MENUITEM "Slot #&6", ID_FILE_SAVE6, GRAYED MENUITEM "Slot #&6", ID_FILE_SAVE6
MENUITEM "Slot #&7", ID_FILE_SAVE7, GRAYED MENUITEM "Slot #&7", ID_FILE_SAVE7
MENUITEM "Slot #&8", ID_FILE_SAVE8, GRAYED MENUITEM "Slot #&8", ID_FILE_SAVE8
MENUITEM "Slot #&9", ID_FILE_SAVE9, GRAYED MENUITEM "Slot #&9", ID_FILE_SAVE9
END END
POPUP "&Load Game Position" POPUP "&Load Game Position"
BEGIN BEGIN
MENUITEM "Slot #&1", ID_FILE_LOAD1 MENUITEM "Slot #&1", ID_FILE_LOAD1
MENUITEM "Slot #&2", ID_FILE_LOAD2, GRAYED MENUITEM "Slot #&2", ID_FILE_LOAD2
MENUITEM "Slot #&3", ID_FILE_LOAD3, GRAYED MENUITEM "Slot #&3", ID_FILE_LOAD3
MENUITEM "Slot #&4", ID_FILE_LOAD4, GRAYED MENUITEM "Slot #&4", ID_FILE_LOAD4
MENUITEM "Slot #&5", ID_FILE_LOAD5, GRAYED MENUITEM "Slot #&5", ID_FILE_LOAD5
MENUITEM "Slot #&6", ID_FILE_LOAD6, GRAYED MENUITEM "Slot #&6", ID_FILE_LOAD6
MENUITEM "Slot #&7", ID_FILE_LOAD7, GRAYED MENUITEM "Slot #&7", ID_FILE_LOAD7
MENUITEM "Slot #&8", ID_FILE_LOAD8, GRAYED MENUITEM "Slot #&8", ID_FILE_LOAD8
MENUITEM "Slot #&9", ID_FILE_LOAD9, GRAYED MENUITEM "Slot #&9", ID_FILE_LOAD9
END END
MENUITEM "Load MultiCart...", ID_FILE_LOADMULTICART MENUITEM "Load MultiCart...", ID_FILE_LOADMULTICART
MENUITEM SEPARATOR MENUITEM SEPARATOR
POPUP "Save Other" POPUP "Save Other"
BEGIN BEGIN
MENUITEM "S&ave SPC Data", ID_FILE_SAVE_SPC_DATA
MENUITEM "Save Screenshot", ID_SAVESCREENSHOT MENUITEM "Save Screenshot", ID_SAVESCREENSHOT
MENUITEM "Sa&ve S-RAM Data", ID_FILE_SAVE_SRAM_DATA, GRAYED MENUITEM "Sa&ve S-RAM Data", ID_FILE_SAVE_SRAM_DATA
END END
MENUITEM "ROM Information...", IDM_ROM_INFO, GRAYED MENUITEM "ROM Information...", IDM_ROM_INFO
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Movie Play...", ID_FILE_MOVIE_PLAY, GRAYED MENUITEM "Movie Play...", ID_FILE_MOVIE_PLAY
MENUITEM "Movie Record...", ID_FILE_MOVIE_RECORD, GRAYED MENUITEM "Movie Record...", ID_FILE_MOVIE_RECORD
MENUITEM "Movie Stop", ID_FILE_MOVIE_STOP, GRAYED MENUITEM "Movie Stop", ID_FILE_MOVIE_STOP
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Record AVI...", ID_FILE_WRITE_AVI, GRAYED MENUITEM "AVI Recording", ID_FILE_AVI_RECORDING
MENUITEM "Stop AVI Recording", ID_FILE_STOP_AVI, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Reset Game", ID_FILE_RESET, GRAYED MENUITEM "&Reset Game", ID_FILE_RESET
MENUITEM "&Pause", ID_FILE_PAUSE, GRAYED
MENUITEM "E&xit\tAlt+F4", ID_FILE_EXIT MENUITEM "E&xit\tAlt+F4", ID_FILE_EXIT
END END
POPUP "&Options" POPUP "&Emulation"
BEGIN BEGIN
MENUITEM "&Display Configuration...\tAlt+F5", ID_OPTIONS_DISPLAY MENUITEM "&Pause", ID_FILE_PAUSE
MENUITEM "Pause &When Inactive", ID_EMULATION_PAUSEWHENINACTIVE
MENUITEM "&Frame Advance", ID_FRAME_ADVANCE
MENUITEM SEPARATOR
MENUITEM "&Settings...\tAlt+F8", ID_OPTIONS_SETTINGS MENUITEM "&Settings...\tAlt+F8", ID_OPTIONS_SETTINGS
END END
POPUP "&Input" POPUP "&Input"
@ -884,31 +869,31 @@ BEGIN
POPUP "&Playback Rate" POPUP "&Playback Rate"
BEGIN BEGIN
MENUITEM "&Mute Sound", ID_SOUND_NOSOUND MENUITEM "&Mute Sound", ID_SOUND_NOSOUND
MENUITEM "8KHz", ID_SOUND_8000HZ, GRAYED MENUITEM "8KHz", ID_SOUND_8000HZ
MENUITEM "11KHz", ID_SOUND_11025HZ, GRAYED MENUITEM "11KHz", ID_SOUND_11025HZ
MENUITEM "16KHz", ID_SOUND_16000HZ, GRAYED MENUITEM "16KHz", ID_SOUND_16000HZ
MENUITEM "22KHz", ID_SOUND_22050HZ, GRAYED MENUITEM "22KHz", ID_SOUND_22050HZ
MENUITEM "30KHz", ID_SOUND_30000HZ, GRAYED MENUITEM "30KHz", ID_SOUND_30000HZ
MENUITEM "32KHz (SNES)", ID_SOUND_32000HZ, GRAYED MENUITEM "32KHz (SNES)", ID_SOUND_32000HZ
MENUITEM "35KHz", ID_SOUND_35000HZ, GRAYED MENUITEM "35KHz", ID_SOUND_35000HZ
MENUITEM "44KHz", ID_SOUND_44100HZ, GRAYED MENUITEM "44KHz", ID_SOUND_44100HZ
MENUITEM "48KHz", ID_SOUND_48000HZ, GRAYED MENUITEM "48KHz", ID_SOUND_48000HZ
END END
POPUP "&Buffer Length" POPUP "&Buffer Length"
BEGIN BEGIN
MENUITEM "16ms", ID_SOUND_16MS MENUITEM "16ms", ID_SOUND_16MS
MENUITEM "32ms", ID_SOUND_32MS, GRAYED MENUITEM "32ms", ID_SOUND_32MS
MENUITEM "48ms", ID_SOUND_48MS, GRAYED MENUITEM "48ms", ID_SOUND_48MS
MENUITEM "64ms", ID_SOUND_64MS, GRAYED MENUITEM "64ms", ID_SOUND_64MS
MENUITEM "80ms", ID_SOUND_80MS, GRAYED MENUITEM "80ms", ID_SOUND_80MS
MENUITEM "96ms", ID_SOUND_96MS, GRAYED MENUITEM "96ms", ID_SOUND_96MS
MENUITEM "112ms", ID_SOUND_112MS, GRAYED MENUITEM "112ms", ID_SOUND_112MS
MENUITEM "128ms", ID_SOUND_128MS, GRAYED MENUITEM "128ms", ID_SOUND_128MS
MENUITEM "144ms", ID_SOUND_144MS, GRAYED MENUITEM "144ms", ID_SOUND_144MS
MENUITEM "160ms", ID_SOUND_160MS, GRAYED MENUITEM "160ms", ID_SOUND_160MS
MENUITEM "176ms", ID_SOUND_176MS, GRAYED MENUITEM "176ms", ID_SOUND_176MS
MENUITEM "194ms", ID_SOUND_194MS, GRAYED MENUITEM "194ms", ID_SOUND_194MS
MENUITEM "210ms", ID_SOUND_210MS, GRAYED MENUITEM "210ms", ID_SOUND_210MS
END END
POPUP "&Channels" POPUP "&Channels"
BEGIN BEGIN
@ -930,26 +915,31 @@ BEGIN
MENUITEM "S&ync Sound\tAlt+]", ID_SOUND_SYNC MENUITEM "S&ync Sound\tAlt+]", ID_SOUND_SYNC
MENUITEM "&Settings...\tAlt+T", ID_SOUND_OPTIONS MENUITEM "&Settings...\tAlt+T", ID_SOUND_OPTIONS
END END
POPUP "&Window" POPUP "&Video"
BEGIN BEGIN
MENUITEM "&Hide menubar\tEsc", ID_WINDOW_HIDEMENUBAR MENUITEM "&Hide menubar\tEsc", ID_WINDOW_HIDEMENUBAR
MENUITEM "&Full Screen\tAlt+Enter", ID_WINDOW_FULLSCREEN MENUITEM "&Full Screen\tAlt+Enter", ID_WINDOW_FULLSCREEN
MENUITEM "&Stretch Image\tAlt+Backspace", 40032 POPUP "&Window Size"
MENUITEM "&Maintain Aspect Ratio", 40123 BEGIN
MENUITEM "Stretch with &Video Card", ID_WINDOW_VIDMEM MENUITEM "&1x" ID_WINDOW_SIZE_1X
MENUITEM "&2x" ID_WINDOW_SIZE_2X
MENUITEM "&3x" ID_WINDOW_SIZE_3X
MENUITEM "&4x" ID_WINDOW_SIZE_4X
END
MENUITEM SEPARATOR MENUITEM SEPARATOR
POPUP "&Language" MENUITEM "&Stretch Image\tAlt+Backspace", ID_WINDOW_STRETCH
BEGIN MENUITEM "&Maintain Aspect Ratio", ID_WINDOW_ASPECTRATIO
MENUITEM "&English", ID_LANGUAGE_ENGLISH, CHECKED MENUITEM "&Bilinear Filtering", ID_WINDOW_BILINEAR
MENUITEM "&Nederlands", ID_LANGUAGE_NEDERLANDS, GRAYED MENUITEM "Show Frame &Rate", ID_VIDEO_SHOWFRAMERATE
END MENUITEM SEPARATOR
MENUITEM "&Display Configuration...\tAlt+F5", ID_OPTIONS_DISPLAY
END END
POPUP "&Cheat" POPUP "&Cheat"
BEGIN BEGIN
MENUITEM "&Game Genie, Pro-Action Replay Codes\tAlt+E", ID_CHEAT_ENTER MENUITEM "&Game Genie, Pro-Action Replay Codes\tAlt+G", ID_CHEAT_ENTER
MENUITEM "&Search for New Cheats", ID_CHEAT_SEARCH_MODAL, GRAYED MENUITEM "&Search for New Cheats", ID_CHEAT_SEARCH_MODAL
MENUITEM "Search for New Cheats (active)\tAlt+A", 40064, GRAYED MENUITEM "Search for New Cheats (active)\tAlt+A", 40064
MENUITEM "&Apply Cheats", ID_CHEAT_APPLY, CHECKED, GRAYED MENUITEM "&Apply Cheats", ID_CHEAT_APPLY, CHECKED
END END
POPUP "&Netplay" POPUP "&Netplay"
BEGIN BEGIN
@ -970,7 +960,7 @@ BEGIN
END END
END END
#endif // English (U.K.) resources #endif // English (U.S.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -5,23 +5,44 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Snes9X", "snes9xw.vcproj",
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
C core|Win32 = C core|Win32 Debug Unicode|Win32 = Debug Unicode|Win32
Debug Unicode|x64 = Debug Unicode|x64
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Debug+ASM|Win32 = Debug+ASM|Win32 Debug+ASM|Win32 = Debug+ASM|Win32
Debug+ASM|x64 = Debug+ASM|x64
Release Unicode|Win32 = Release Unicode|Win32
Release Unicode|x64 = Release Unicode|x64
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release+ASM|Win32 = Release+ASM|Win32 Release+ASM|Win32 = Release+ASM|Win32
Release+ASM|x64 = Release+ASM|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.C core|Win32.ActiveCfg = C core|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.C core|Win32.Build.0 = C core|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug Unicode|x64.Build.0 = Debug Unicode|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug|Win32.ActiveCfg = Debug|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug|Win32.ActiveCfg = Debug|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug|Win32.Build.0 = Debug|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug|Win32.Build.0 = Debug|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug|x64.ActiveCfg = Debug|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug|x64.Build.0 = Debug|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug+ASM|Win32.ActiveCfg = Debug+ASM|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug+ASM|Win32.ActiveCfg = Debug+ASM|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug+ASM|Win32.Build.0 = Debug+ASM|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug+ASM|Win32.Build.0 = Debug+ASM|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug+ASM|x64.ActiveCfg = Debug+ASM|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Debug+ASM|x64.Build.0 = Debug+ASM|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release Unicode|x64.ActiveCfg = Release Unicode|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release Unicode|x64.Build.0 = Release Unicode|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release|Win32.ActiveCfg = Release|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release|Win32.ActiveCfg = Release|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release|Win32.Build.0 = Release|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release|Win32.Build.0 = Release|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release|x64.ActiveCfg = Release|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release|x64.Build.0 = Release|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release+ASM|Win32.ActiveCfg = Release+ASM|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release+ASM|Win32.ActiveCfg = Release+ASM|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release+ASM|Win32.Build.0 = Release+ASM|Win32 {B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release+ASM|Win32.Build.0 = Release+ASM|Win32
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release+ASM|x64.ActiveCfg = Release+ASM|x64
{B86059D8-C9A6-46BE-8FBA-3170C54F1DFD}.Release+ASM|x64.Build.0 = Release+ASM|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

File diff suppressed because it is too large Load Diff

View File

@ -223,8 +223,8 @@ void S9xParseArg (char **argv, int &i, int argc)
} }
} }
extern char multiRomA [MAX_PATH]; // lazy, should put in sGUI and add init to {0} somewhere extern TCHAR multiRomA [MAX_PATH]; // lazy, should put in sGUI and add init to {0} somewhere
extern char multiRomB [MAX_PATH]; extern TCHAR multiRomB [MAX_PATH];
void WinSetDefaultValues () void WinSetDefaultValues ()
{ {
@ -237,54 +237,19 @@ void WinSetDefaultValues ()
GUI.ValidControllerOptions = 0xFFFF; GUI.ValidControllerOptions = 0xFFFF;
GUI.IgnoreNextMouseMove = false; GUI.IgnoreNextMouseMove = false;
GUI.HideMenu = false;
GUI.window_size.left = 0;
GUI.window_size.right = 524;
GUI.window_size.top = 0;
GUI.window_size.bottom = 524;
GUI.FullscreenMode.width = 640;
GUI.FullscreenMode.height = 480;
GUI.FullscreenMode.depth = 16;
GUI.Scale = FILTER_NONE;
GUI.NextScale = FILTER_NONE;
GUI.ScaleHiRes = FILTER_NONE;
GUI.NextScaleHiRes = FILTER_NONE;
GUI.DoubleBuffered = false; GUI.DoubleBuffered = false;
GUI.FullScreen = false; GUI.FullScreen = false;
GUI.Stretch = false; GUI.Stretch = false;
GUI.FlipCounter = 0; GUI.FlipCounter = 0;
GUI.NumFlipFrames = 1; GUI.NumFlipFrames = 1;
GUI.BilinearFilter = false; GUI.BilinearFilter = false;
GUI.ScreenCleared = true;
GUI.LockDirectories = false; GUI.LockDirectories = false;
GUI.window_maximized = false; GUI.window_maximized = false;
GUI.EmulatedFullscreen = false;
WinDeleteRecentGamesList (); WinDeleteRecentGamesList ();
// ROM Options
memset (&Settings, 0, sizeof (Settings));
Settings.ForceLoROM = false;
Settings.ForceInterleaved = false;
Settings.ForceNotInterleaved = false;
Settings.ForceInterleaved = false;
Settings.ForceInterleaved2 = false;
Settings.ForcePAL = false;
Settings.ForceNTSC = false;
Settings.ForceHeader = false;
Settings.ForceNoHeader = false;
// Sound options
Settings.SoundSync = FALSE;
Settings.Mute = FALSE;
Settings.SoundPlaybackRate = 32000;
Settings.SixteenBitSound = TRUE;
Settings.Stereo = TRUE;
Settings.ReverseStereo = FALSE;
GUI.SoundChannelEnable=255; GUI.SoundChannelEnable=255;
GUI.FAMute = FALSE;
// Tracing options // Tracing options
Settings.TraceDMA = false; Settings.TraceDMA = false;
@ -300,40 +265,13 @@ void WinSetDefaultValues ()
Settings.FrameTime = 16667; Settings.FrameTime = 16667;
// CPU options // CPU options
Settings.HDMATimingHack = 100;
Settings.Shutdown = false;
Settings.ShutdownMaster = false;
Settings.DisableIRQ = false;
Settings.Paused = false; Settings.Paused = false;
Timings.H_Max = SNES_CYCLES_PER_SCANLINE;
Timings.HBlankStart = (256 * Timings.H_Max) / SNES_HCOUNTER_MAX;
Settings.SkipFrames = AUTO_FRAMERATE;
// ROM image and peripheral options // ROM image and peripheral options
Settings.MultiPlayer5Master = false; Settings.MultiPlayer5Master = false;
Settings.SuperScopeMaster = false; Settings.SuperScopeMaster = false;
Settings.MouseMaster = false; Settings.MouseMaster = false;
Settings.SuperFX = false; //Settings.SuperFX = false;
// SNES graphics options
Settings.DisableGraphicWindows = false;
Settings.DisableHDMA = false;
GUI.HeightExtend = false;
Settings.DisplayFrameRate = false;
// Settings.SixteenBit = true;
Settings.Transparency = true;
Settings.SupportHiRes = true;
Settings.AutoDisplayMessages = false; // this port supports text display on post-rendered surface
Settings.DisplayPressedKeys = 0;
GUI.CurrentSaveSlot = 0;
Settings.AutoSaveDelay = 15;
Settings.ApplyCheats = true;
Settings.TurboMode = false;
Settings.TurboSkipFrames = 15;
GUI.TurboModeToggle = true;
Settings.AutoMaxSkipFrames = 1;
#ifdef NETPLAY_SUPPORT #ifdef NETPLAY_SUPPORT
Settings.Port = 1996; Settings.Port = 1996;
@ -343,11 +281,7 @@ void WinSetDefaultValues ()
NPServer.SendROMImageOnConnect = false; NPServer.SendROMImageOnConnect = false;
#endif #endif
GUI.FreezeFileDir [0] = 0;
Settings.TakeScreenshot=false; Settings.TakeScreenshot=false;
Settings.StretchScreenshots=1;
GUI.EmulatedFullscreen = false;
GUI.Language=0; GUI.Language=0;
} }
@ -368,7 +302,7 @@ static char rom_filename [MAX_PATH] = {0,};
static bool S9xSaveConfigFile(ConfigFile &conf){ static bool S9xSaveConfigFile(ConfigFile &conf){
configMutex = CreateMutex(NULL, FALSE, "Snes9xConfigMutex"); configMutex = CreateMutex(NULL, FALSE, TEXT("Snes9xConfigMutex"));
int times = 0; int times = 0;
DWORD waitVal = WAIT_TIMEOUT; DWORD waitVal = WAIT_TIMEOUT;
while(waitVal == WAIT_TIMEOUT && ++times <= 150) // wait at most 15 seconds while(waitVal == WAIT_TIMEOUT && ++times <= 150) // wait at most 15 seconds
@ -382,7 +316,7 @@ static bool S9xSaveConfigFile(ConfigFile &conf){
// ensure previous config file is not lost if we crash while writing the new one // ensure previous config file is not lost if we crash while writing the new one
std::string ftemp; std::string ftemp;
{ {
CopyFile(fname.c_str(), (fname + ".autobak").c_str(), FALSE); CopyFileA(fname.c_str(), (fname + ".autobak").c_str(), FALSE);
ftemp=S9xGetDirectory(DEFAULT_DIR); ftemp=S9xGetDirectory(DEFAULT_DIR);
ftemp+=SLASH_STR "config_error"; ftemp+=SLASH_STR "config_error";
@ -425,7 +359,7 @@ const char* WinParseCommandLineAndLoadConfigFile (char *line)
static char *parameters [MAX_PARAMETERS]; static char *parameters [MAX_PARAMETERS];
int count = 0; int count = 0;
parameters [count++] = "Snes9XW"; parameters [count++] = "Snes9X";
while (count < MAX_PARAMETERS && *p) while (count < MAX_PARAMETERS && *p)
{ {
@ -458,7 +392,7 @@ const char* WinParseCommandLineAndLoadConfigFile (char *line)
} }
} }
configMutex = CreateMutex(NULL, FALSE, "Snes9xConfigMutex"); configMutex = CreateMutex(NULL, FALSE, TEXT("Snes9xConfigMutex"));
int times = 0; int times = 0;
DWORD waitVal = WAIT_TIMEOUT; DWORD waitVal = WAIT_TIMEOUT;
while(waitVal == WAIT_TIMEOUT && ++times <= 150) // wait at most 15 seconds while(waitVal == WAIT_TIMEOUT && ++times <= 150) // wait at most 15 seconds
@ -485,7 +419,7 @@ const char* WinParseCommandLineAndLoadConfigFile (char *line)
if(tempfile) if(tempfile)
{ {
fclose(tempfile); fclose(tempfile);
MoveFileEx((fname + ".autobak").c_str(), fname.c_str(), MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH); MoveFileExA((fname + ".autobak").c_str(), fname.c_str(), MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH);
} }
} }
remove(ftemp.c_str()); remove(ftemp.c_str());
@ -612,8 +546,8 @@ struct ConfigItem
if(size == 8) *(uint64*)addr = (uint64)conf.GetUInt(name, reinterpret_cast<uint32>(def)); if(size == 8) *(uint64*)addr = (uint64)conf.GetUInt(name, reinterpret_cast<uint32>(def));
break; break;
case CIT_STRING: case CIT_STRING:
strncpy((char*)addr, conf.GetString(name, reinterpret_cast<const char*>(def)), size-1); lstrcpyn((TCHAR*)addr, _tFromChar(conf.GetString(name, reinterpret_cast<const char*>(def))), size-1);
((char*)addr)[size-1] = '\0'; ((TCHAR*)addr)[size-1] = TEXT('\0');
break; break;
case CIT_INVBOOL: case CIT_INVBOOL:
case CIT_INVBOOLONOFF: case CIT_INVBOOLONOFF:
@ -718,8 +652,8 @@ struct ConfigItem
if(size == 8) conf.SetUInt(name, (uint32)(*(uint64*)addr), 10, comment); if(size == 8) conf.SetUInt(name, (uint32)(*(uint64*)addr), 10, comment);
break; break;
case CIT_STRING: case CIT_STRING:
if((char*)addr) if((TCHAR*)addr)
conf.SetString(name, (char*)addr, comment); conf.SetString(name, std::string(_tToChar((TCHAR*)addr)), comment);
break; break;
case CIT_INVBOOL: case CIT_INVBOOL:
if(size == 1) conf.SetBool(name, 0==(*(uint8 *)addr), "TRUE","FALSE", comment); if(size == 1) conf.SetBool(name, 0==(*(uint8 *)addr), "TRUE","FALSE", comment);
@ -772,7 +706,7 @@ struct ConfigItem
std::vector<ConfigItem> configItems; std::vector<ConfigItem> configItems;
// var must be a persistent variable. In the case of strings, it must point to a writeable character array. // var must be a persistent variable. In the case of strings, it must point to a writeable character array.
#define AddItemC(name, var, def, comment, type) configItems.push_back(ConfigItem((const char*)(CATEGORY "::" name), (void*)(pint)(&var), sizeof(var), (void*)(pint)def, (const char*)comment, (ConfigItemType)type)) #define AddItemC(name, var, def, comment, type) configItems.push_back(ConfigItem((const char*)(CATEGORY "::" name), (void*)(&var), sizeof(var), (void*)(pint)def, (const char*)comment, (ConfigItemType)type))
#define AddItem(name, var, def, type) AddItemC(name,var,def,"",type) #define AddItem(name, var, def, type) AddItemC(name,var,def,"",type)
#define AddUInt(name, var, def) AddItem(name,var,def,CIT_UINT) #define AddUInt(name, var, def) AddItem(name,var,def,CIT_UINT)
#define AddInt(name, var, def) AddItem(name,var,def,CIT_INT) #define AddInt(name, var, def) AddItem(name,var,def,CIT_INT)
@ -788,7 +722,7 @@ std::vector<ConfigItem> configItems;
#define AddBool2C(name, var, def, comment) AddItemC(name,var,def,comment,CIT_BOOLONOFF) #define AddBool2C(name, var, def, comment) AddItemC(name,var,def,comment,CIT_BOOLONOFF)
#define AddInvBoolC(name, var, def, comment) AddItemC(name,var,def,comment,CIT_INVBOOL) #define AddInvBoolC(name, var, def, comment) AddItemC(name,var,def,comment,CIT_INVBOOL)
#define AddInvBool2C(name, var, def, comment) AddItemC(name,var,def,comment,CIT_INVBOOLONOFF) #define AddInvBool2C(name, var, def, comment) AddItemC(name,var,def,comment,CIT_INVBOOLONOFF)
#define AddStringC(name, var, buflen, def, comment) configItems.push_back(ConfigItem((const char*)(CATEGORY "::" name), (void*)(pint)var, buflen, (void*)(pint)def, (const char*)comment, CIT_STRING)) #define AddStringC(name, var, buflen, def, comment) configItems.push_back(ConfigItem((const char*)(CATEGORY "::" name), (void*)var, buflen, (void*)(pint)def, (const char*)comment, CIT_STRING))
#define AddString(name, var, buflen, def) AddStringC(name, var, buflen, def, "") #define AddString(name, var, buflen, def) AddStringC(name, var, buflen, def, "")
static char filterString [1024], filterString2 [1024], snapVerString [256]; static char filterString [1024], filterString2 [1024], snapVerString [256];
@ -891,7 +825,6 @@ void WinPostSave(ConfigFile& conf)
void WinPostLoad(ConfigFile& conf) void WinPostLoad(ConfigFile& conf)
{ {
int i; int i;
GUI.NextScale = GUI.Scale;
if(Settings.DisplayPressedKeys) Settings.DisplayPressedKeys = 2; if(Settings.DisplayPressedKeys) Settings.DisplayPressedKeys = 2;
for(i=0;i<8;i++) Joypad[i+8].Enabled = Joypad[i].Enabled; for(i=0;i<8;i++) Joypad[i+8].Enabled = Joypad[i].Enabled;
if(GUI.MaxRecentGames < 1) GUI.MaxRecentGames = 1; if(GUI.MaxRecentGames < 1) GUI.MaxRecentGames = 1;
@ -903,8 +836,8 @@ void WinPostLoad(ConfigFile& conf)
gap = true; gap = true;
else if(gap) else if(gap)
{ {
memmove(GUI.RecentGames[i-1], GUI.RecentGames[i], MAX_PATH); memmove(GUI.RecentGames[i-1], GUI.RecentGames[i], MAX_PATH * sizeof(TCHAR));
*GUI.RecentGames[i] = '\0'; *GUI.RecentGames[i] = TEXT('\0');
gap = false; gap = false;
i = -1; i = -1;
} }
@ -964,7 +897,11 @@ void WinRegisterConfigItems()
AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=DirectDraw, 1=Direct3D"); AddUIntC("OutputMethod", GUI.outputMethod, 1, "0=DirectDraw, 1=Direct3D");
AddUIntC("FilterType", GUI.Scale, 0, filterString); AddUIntC("FilterType", GUI.Scale, 0, filterString);
AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2); AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2);
AddBoolC("ShaderEnabled", GUI.shaderEnabled, false, "true to use pixel shader (if supported by output method)");
AddStringC("Direct3D:HLSLFileName", GUI.HLSLshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode");
AddStringC("OpenGL:GLSLFileName", GUI.GLSLshaderFileName, MAX_PATH, "", "shader filename for OpenGL mode (bsnes-style XML shader)");
AddBoolC("ExtendHeight", GUI.HeightExtend, false, "true to display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240."); AddBoolC("ExtendHeight", GUI.HeightExtend, false, "true to display an extra 15 pixels at the bottom, which few games use. Also increases AVI output size from 256x224 to 256x240.");
AddBoolC("AlwaysCenterImage", GUI.AlwaysCenterImage,false, "true to center the image even if larger than window");
AddIntC("Window:Width", GUI.window_size.right, 512, "256=1x, 512=2x, 768=3x, 1024=4x, etc. (usually)"); AddIntC("Window:Width", GUI.window_size.right, 512, "256=1x, 512=2x, 768=3x, 1024=4x, etc. (usually)");
AddIntC("Window:Height", GUI.window_size.bottom, 448, "224=1x, 448=2x, 672=3x, 896=4x, etc. (usually)"); AddIntC("Window:Height", GUI.window_size.bottom, 448, "224=1x, 448=2x, 672=3x, 896=4x, etc. (usually)");
AddIntC("Window:Left", GUI.window_size.left, 0, "in pixels from left edge of screen"); AddIntC("Window:Left", GUI.window_size.left, 0, "in pixels from left edge of screen");
@ -974,7 +911,7 @@ void WinRegisterConfigItems()
AddBoolC("Stretch:MaintainAspectRatio", GUI.AspectRatio, true, "prevents stretching from changing the aspect ratio"); AddBoolC("Stretch:MaintainAspectRatio", GUI.AspectRatio, true, "prevents stretching from changing the aspect ratio");
AddUIntC("Stretch:AspectRatioBaseWidth", GUI.AspectWidth, 256, "base width for aspect ratio calculation (AR=AspectRatioBaseWidth/224), default is 256 - set to 299 for 4:3 aspect ratio"); AddUIntC("Stretch:AspectRatioBaseWidth", GUI.AspectWidth, 256, "base width for aspect ratio calculation (AR=AspectRatioBaseWidth/224), default is 256 - set to 299 for 4:3 aspect ratio");
AddBoolC("Stretch:BilinearFilter", GUI.BilinearFilter, true, "allows bilinear filtering of stretching. Depending on your video card and the window size, this may result in a lower framerate."); AddBoolC("Stretch:BilinearFilter", GUI.BilinearFilter, true, "allows bilinear filtering of stretching. Depending on your video card and the window size, this may result in a lower framerate.");
AddBoolC("Stretch:LocalVidMem", GUI.LocalVidMem, true, "determines the location of video memory, if UseVideoMemory = true. May increase or decrease rendering performance, depending on your setup and which filter and stretching options are active."); AddBoolC("Stretch:LocalVidMem", GUI.LocalVidMem, true, "determines the location of video memory in DirectDraw mode. May increase or decrease rendering performance, depending on your setup and which filter and stretching options are active.");
AddBool("Fullscreen:Enabled", GUI.FullScreen, false); AddBool("Fullscreen:Enabled", GUI.FullScreen, false);
AddUInt("Fullscreen:Width", GUI.FullscreenMode.width, 640); AddUInt("Fullscreen:Width", GUI.FullscreenMode.width, 640);
AddUInt("Fullscreen:Height", GUI.FullscreenMode.height, 480); AddUInt("Fullscreen:Height", GUI.FullscreenMode.height, 480);
@ -983,11 +920,11 @@ void WinRegisterConfigItems()
AddBool("Fullscreen:DoubleBuffered", GUI.DoubleBuffered, false); AddBool("Fullscreen:DoubleBuffered", GUI.DoubleBuffered, false);
AddBoolC("Fullscreen:EmulateFullscreen", GUI.EmulateFullscreen, true,"true makes snes9x create a window that spans the entire screen when going fullscreen"); AddBoolC("Fullscreen:EmulateFullscreen", GUI.EmulateFullscreen, true,"true makes snes9x create a window that spans the entire screen when going fullscreen");
AddBoolC("HideMenu", GUI.HideMenu, false, "true to auto-hide the menu bar on startup."); AddBoolC("HideMenu", GUI.HideMenu, false, "true to auto-hide the menu bar on startup.");
AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync, only available with Direct3D"); AddBoolC("Vsync", GUI.Vsync, false, "true to enable Vsync");
#undef CATEGORY #undef CATEGORY
#define CATEGORY "Settings" #define CATEGORY "Settings"
AddUIntC("FrameSkip", Settings.SkipFrames, AUTO_FRAMERATE, "200=automatic, 0=none, 1=skip every other, ..."); AddUIntC("FrameSkip", Settings.SkipFrames, AUTO_FRAMERATE, "200=automatic (limits at 50/60 fps), 0=none, 1=skip every other, ...");
AddUIntC("AutoMaxSkipFramesAtOnce", Settings.AutoMaxSkipFrames, 0, "most frames to skip at once to maintain speed, don't set to more than 1 or 2 frames because the skipping algorithm isn't very smart"); AddUIntC("AutoMaxSkipFramesAtOnce", Settings.AutoMaxSkipFrames, 0, "most frames to skip at once to maintain speed in automatic mode, don't set to more than 1 or 2 frames because the skipping algorithm isn't very smart");
AddUIntC("TurboFrameSkip", Settings.TurboSkipFrames, 15, "how many frames to skip when in fast-forward mode"); AddUIntC("TurboFrameSkip", Settings.TurboSkipFrames, 15, "how many frames to skip when in fast-forward mode");
AddUInt("AutoSaveDelay", Settings.AutoSaveDelay, 30); AddUInt("AutoSaveDelay", Settings.AutoSaveDelay, 30);
AddBool2C("SpeedHacks", Settings.ShutdownMaster, false, "on to skip emulating the CPU when it is not being used ... recommended OFF"); AddBool2C("SpeedHacks", Settings.ShutdownMaster, false, "on to skip emulating the CPU when it is not being used ... recommended OFF");
@ -1028,29 +965,21 @@ void WinRegisterConfigItems()
ADD(25); ADD(26); ADD(27); ADD(28); ADD(29); ADD(30); ADD(31); ADD(32); ADD(25); ADD(26); ADD(27); ADD(28); ADD(29); ADD(30); ADD(31); ADD(32);
assert(MAX_RECENT_GAMES_LIST_SIZE == 32); assert(MAX_RECENT_GAMES_LIST_SIZE == 32);
#undef ADD #undef ADD
AddString("Pack:StarOcean", GUI.StarOceanPack, _MAX_PATH, "");
AddString("Pack:FarEast", GUI.FEOEZPack, _MAX_PATH, "");
AddString("Pack:SFA2NTSC", GUI.SFA2NTSCPack, _MAX_PATH, "");
AddString("Pack:SFA2PAL", GUI.SFA2PALPack, _MAX_PATH, "");
AddString("Pack:Momotarou", GUI.MDHPack, _MAX_PATH, "");
AddString("Pack:SFZ2", GUI.SFZ2Pack, _MAX_PATH, "");
AddString("Pack:ShounenJump", GUI.SJNSPack, _MAX_PATH, "");
AddString("Pack:SPL4", GUI.SPL4Pack, _MAX_PATH, "");
AddString("Rom:MultiCartA", multiRomA, _MAX_PATH, ""); AddString("Rom:MultiCartA", multiRomA, _MAX_PATH, "");
AddString("Rom:MultiCartB", multiRomB, _MAX_PATH, ""); AddString("Rom:MultiCartB", multiRomB, _MAX_PATH, "");
#undef CATEGORY #undef CATEGORY
#define CATEGORY "Sound" #define CATEGORY "Sound"
AddIntC("Sync", Settings.SoundSync, 1, "1 to enable sound sync to CPU, 0 to disable. Necessary for some sounds to be accurate. Not supported unless SoundDriver=0. May cause sound problems on certain setups."); AddIntC("Sync", Settings.SoundSync, 1, "1 to sync emulation to sound output, 0 to disable.");
AddBool2("Stereo", Settings.Stereo, true); AddBool2("Stereo", Settings.Stereo, true);
AddBool("SixteenBitSound", Settings.SixteenBitSound, true); AddBool("SixteenBitSound", Settings.SixteenBitSound, true);
AddUIntC("Rate", Settings.SoundPlaybackRate, 32000, "sound playback quality, in Hz: 1=8000, 2=11025, 3=16000, 4=22050, 5=30000, 6=32000, 7=35000, 8=44100, 9=48000"); AddUIntC("Rate", Settings.SoundPlaybackRate, 32000, "sound playback quality, in Hz");
AddUIntC("InputRate", Settings.SoundInputRate, 31900, ""); AddUIntC("InputRate", Settings.SoundInputRate, 31900, "for each 'Input rate' samples generated by the SNES, 'Playback rate' samples will produced. If you experience crackling you can try to lower this setting.");
AddBoolC("ReverseStereo", Settings.ReverseStereo, false, "true to swap speaker outputs"); AddBoolC("ReverseStereo", Settings.ReverseStereo, false, "true to swap speaker outputs");
AddBoolC("Mute", GUI.Mute, false, "true to mute sound output (does not disable the sound CPU)"); AddBoolC("Mute", GUI.Mute, false, "true to mute sound output (does not disable the sound CPU)");
#undef CATEGORY #undef CATEGORY
#define CATEGORY "Sound\\Win" #define CATEGORY "Sound\\Win"
AddUIntC("SoundDriver", GUI.SoundDriver, 4, "0=Snes9xDirectSound (recommended), 1=fmodDirectSound, 2=fmodWaveSound, 3=fmodA3DSound, 4=XAudio2"); AddUIntC("SoundDriver", GUI.SoundDriver, 4, "0=Snes9xDirectSound, 4=XAudio2 (recommended), 5=FMOD Default, 6=FMOD ASIO, 7=FMOD OpenAL");
AddUIntC("BufferSize", GUI.SoundBufferSize, 64, "sound buffer size - the mixing interval is multiplied by this (and an additional *4 in case of DirectSound) "); AddUIntC("BufferSize", GUI.SoundBufferSize, 64, "sound buffer size in ms - determines the internal and output sound buffer sizes. actual mixing is done every SoundBufferSize/4 samples");
AddBoolC("MuteFrameAdvance", GUI.FAMute, false, "true to prevent Snes9x from outputting sound when the Frame Advance command is in use"); AddBoolC("MuteFrameAdvance", GUI.FAMute, false, "true to prevent Snes9x from outputting sound when the Frame Advance command is in use");
#undef CATEGORY #undef CATEGORY
#define CATEGORY "Controls" #define CATEGORY "Controls"
@ -1058,7 +987,7 @@ void WinRegisterConfigItems()
#undef CATEGORY #undef CATEGORY
#define CATEGORY "ROM" #define CATEGORY "ROM"
AddBoolC("Cheat", Settings.ApplyCheats, true, "true to allow enabled cheats to be applied"); AddBoolC("Cheat", Settings.ApplyCheats, true, "true to allow enabled cheats to be applied");
AddInvBoolC("Patch", Settings.NoPatch, true, "true to allow IPS patches to be applied (\"soft patching\")"); AddInvBoolC("Patch", Settings.NoPatch, true, "true to allow IPS/UPS patches to be applied (\"soft patching\")");
AddBoolC("BS", Settings.BS, false, "Broadcast Satellaview emulation"); AddBoolC("BS", Settings.BS, false, "Broadcast Satellaview emulation");
AddStringC("Filename", rom_filename, MAX_PATH, "", "filename of ROM to run when Snes9x opens"); AddStringC("Filename", rom_filename, MAX_PATH, "", "filename of ROM to run when Snes9x opens");
#undef CATEGORY #undef CATEGORY
@ -1141,13 +1070,13 @@ void WinLockConfigFile ()
STREAM fp; STREAM fp;
if((fp=OPEN_STREAM(fname.c_str(), "r"))!=NULL){ if((fp=OPEN_STREAM(fname.c_str(), "r"))!=NULL){
CLOSE_STREAM(fp); CLOSE_STREAM(fp);
locked_file=CreateFile(fname.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); locked_file=CreateFileA(fname.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
} else { } else {
fname=S9xGetDirectory(DEFAULT_DIR); fname=S9xGetDirectory(DEFAULT_DIR);
fname+=SLASH_STR "snes9x.cfg"; fname+=SLASH_STR "snes9x.cfg";
if((fp=OPEN_STREAM(fname.c_str(), "r"))!=NULL){ if((fp=OPEN_STREAM(fname.c_str(), "r"))!=NULL){
CLOSE_STREAM(fp); CLOSE_STREAM(fp);
locked_file=CreateFile(fname.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); locked_file=CreateFileA(fname.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
} }
} }
} }

869
win32/wglext.h Normal file
View File

@ -0,0 +1,869 @@
#ifndef __wglext_h_
#define __wglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2010 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Function declaration macros - to move into glplatform.h */
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
#ifndef GLAPI
#define GLAPI extern
#endif
/*************************************************************/
/* Header file version number */
/* wglext.h last updated 2010/02/10 */
/* Current version at http://www.opengl.org/registry/ */
#define WGL_WGLEXT_VERSION 18
#ifndef WGL_ARB_buffer_region
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
#endif
#ifndef WGL_ARB_multisample
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#endif
#ifndef WGL_ARB_extensions_string
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#endif
#ifndef WGL_ARB_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036
#endif
#ifndef WGL_ARB_render_texture
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090
#endif
#ifndef WGL_ARB_pixel_format_float
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
#endif
#ifndef WGL_ARB_create_context
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#endif
#ifndef WGL_EXT_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
#endif
#ifndef WGL_EXT_depth_float
#define WGL_DEPTH_FLOAT_EXT 0x2040
#endif
#ifndef WGL_3DFX_multisample
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061
#endif
#ifndef WGL_EXT_multisample
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
#endif
#ifndef WGL_I3D_gamma
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
#endif
#ifndef WGL_I3D_genlock
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
#endif
#ifndef WGL_I3D_swap_frame_lock
#endif
#ifndef WGL_NV_render_depth_texture
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
#define WGL_DEPTH_COMPONENT_NV 0x20A7
#endif
#ifndef WGL_NV_render_texture_rectangle
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
#endif
#ifndef WGL_ATI_pixel_format_float
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#endif
#ifndef WGL_NV_float_buffer
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
#endif
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
#endif
#ifndef WGL_NV_present_video
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
#endif
#ifndef WGL_NV_video_out
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define WGL_VIDEO_OUT_FRAME 0x20C8
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
#endif
#ifndef WGL_NV_swap_group
#endif
#ifndef WGL_NV_gpu_affinity
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
#endif
#ifndef WGL_AMD_gpu_association
#define WGL_GPU_VENDOR_AMD 0x1F00
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define WGL_GPU_RAM_AMD 0x21A3
#define WGL_GPU_CLOCK_AMD 0x21A4
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8
#endif
#ifndef NV_video_capture
#define WGL_UNIQUE_ID_NV 0x20CE
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
#endif
#ifndef NV_copy_image
#endif
/*************************************************************/
#ifndef WGL_ARB_pbuffer
DECLARE_HANDLE(HPBUFFERARB);
#endif
#ifndef WGL_EXT_pbuffer
DECLARE_HANDLE(HPBUFFEREXT);
#endif
#ifndef WGL_NV_present_video
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
#endif
#ifndef WGL_NV_video_output
DECLARE_HANDLE(HPVIDEODEV);
#endif
#ifndef WGL_NV_gpu_affinity
DECLARE_HANDLE(HPGPUNV);
DECLARE_HANDLE(HGPUNV);
typedef struct _GPU_DEVICE {
DWORD cb;
CHAR DeviceName[32];
CHAR DeviceString[128];
DWORD Flags;
RECT rcVirtualScreen;
} GPU_DEVICE, *PGPU_DEVICE;
#endif
#ifndef WGL_NV_video_capture
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
#endif
#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif
#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1
#endif
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
extern HDC WINAPI wglGetCurrentReadDCARB (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif
#ifndef WGL_ARB_pixel_format_float
#define WGL_ARB_pixel_format_float 1
#endif
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#endif
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
#endif
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
#endif
#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSwapIntervalEXT (int interval);
extern int WINAPI wglGetSwapIntervalEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
#endif
#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1
#endif
#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
extern void WINAPI wglFreeMemoryNV (void *pointer);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
#endif
#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1
#endif
#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1
#endif
#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
#endif
#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif
#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
#endif
#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableFrameLockI3D (void);
extern BOOL WINAPI wglDisableFrameLockI3D (void);
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
#endif
#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif
#ifndef WGL_ATI_pixel_format_float
#define WGL_ATI_pixel_format_float 1
#endif
#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1
#endif
#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
#endif
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1
#endif
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_EXT_framebuffer_sRGB 1
#endif
#ifndef WGL_NV_present_video
#define WGL_NV_present_video 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
#endif
#ifndef WGL_NV_video_output
#define WGL_NV_video_output 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#ifndef WGL_NV_swap_group
#define WGL_NV_swap_group 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
#endif
#ifndef WGL_NV_gpu_affinity
#define WGL_NV_gpu_affinity 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
#endif
#ifndef WGL_AMD_gpu_association
#define WGL_AMD_gpu_association 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#ifndef WGL_NV_video_capture
#define WGL_NV_video_capture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif
#ifndef WGL_NV_copy_image
#define WGL_NV_copy_image 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -284,31 +284,19 @@ const char *S9xGetFilename (const char *ex, enum s9x_getdirtype dirtype)
return (filename); return (filename);
} }
const void S9xGetLastDirectory (char* buffer, int buf_len) #define IS_SLASH(x) ((x) == TEXT('\\') || (x) == TEXT('/'))
{ static TCHAR startDirectory [PATH_MAX];
if(buf_len <= 0)
return;
GetCurrentDirectory(buf_len, buffer);
}
#define IS_SLASH(x) ((x) == '\\' || (x) == '/')
static char startDirectory [PATH_MAX];
static bool startDirectoryValid = false; static bool startDirectoryValid = false;
const char *S9xGetDirectory (enum s9x_getdirtype dirtype) const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
{ {
// _fullpath
if(!startDirectoryValid) if(!startDirectoryValid)
{ {
// directory from which the executable was launched
// GetCurrentDirectory(PATH_MAX, startDirectory);
// directory of the executable's location: // directory of the executable's location:
GetModuleFileName(NULL, startDirectory, PATH_MAX); GetModuleFileName(NULL, startDirectory, PATH_MAX);
for(int i=strlen(startDirectory); i>=0; i--){ for(int i=lstrlen(startDirectory); i>=0; i--){
if(IS_SLASH(startDirectory[i])){ if(IS_SLASH(startDirectory[i])){
startDirectory[i]='\0'; startDirectory[i]=TEXT('\0');
break; break;
} }
} }
@ -318,7 +306,7 @@ const char *S9xGetDirectory (enum s9x_getdirtype dirtype)
SetCurrentDirectory(startDirectory); // makes sure relative paths are relative to the application's location SetCurrentDirectory(startDirectory); // makes sure relative paths are relative to the application's location
const char* rv = startDirectory; const TCHAR* rv = startDirectory;
switch(dirtype){ switch(dirtype){
default: default:
@ -356,13 +344,13 @@ const char *S9xGetDirectory (enum s9x_getdirtype dirtype)
break; break;
case ROMFILENAME_DIR: { case ROMFILENAME_DIR: {
static char filename [PATH_MAX]; static TCHAR filename [PATH_MAX];
strcpy(filename, Memory.ROMFilename); lstrcpy(filename, _tFromChar(Memory.ROMFilename));
if(!filename[0]) if(!filename[0])
rv = GUI.RomDir; rv = GUI.RomDir;
for(int i=strlen(filename); i>=0; i--){ for(int i=lstrlen(filename); i>=0; i--){
if(IS_SLASH(filename[i])){ if(IS_SLASH(filename[i])){
filename[i]='\0'; filename[i]=TEXT('\0');
break; break;
} }
} }
@ -371,35 +359,18 @@ const char *S9xGetDirectory (enum s9x_getdirtype dirtype)
break; break;
} }
mkdir(rv); _tmkdir(rv);
return rv; return rv;
} }
///*extern "C"*/ const char *S9xGetFilename (const char *e) const char *S9xGetDirectory (enum s9x_getdirtype dirtype)
//{ {
// static char filename [_MAX_PATH + 1]; static char path[PATH_MAX]={0};
// char drive [_MAX_DRIVE + 1]; strncpy(path,_tToChar(S9xGetDirectoryT(dirtype)),PATH_MAX-1);
// char dir [_MAX_DIR + 1];
// char fname [_MAX_FNAME + 1]; return path;
// char ext [_MAX_EXT + 1]; }
//
// if (strlen (GUI.FreezeFileDir))
// {
// _splitpath (Memory.ROMFilename, drive, dir, fname, ext);
// strcpy (filename, GUI.FreezeFileDir);
// strcat (filename, TEXT("\\"));
// strcat (filename, fname);
// strcat (filename, e);
// }
// else
// {
// _splitpath (Memory.ROMFilename, drive, dir, fname, ext);
// _makepath (filename, drive, dir, fname, e);
// }
//
// return (filename);
//}
const char *S9xGetFilenameInc (const char *e, enum s9x_getdirtype dirtype) const char *S9xGetFilenameInc (const char *e, enum s9x_getdirtype dirtype)
{ {
@ -488,17 +459,17 @@ void S9xMessage (int type, int, const char *str)
case S9X_WARNING: case S9X_WARNING:
fprintf(stdout, "%s\n", str); fprintf(stdout, "%s\n", str);
if(Settings.StopEmulation) if(Settings.StopEmulation)
MessageBox(GUI.hWnd, str, "Warning", MB_OK | MB_ICONWARNING); MessageBoxA(GUI.hWnd, str, "Warning", MB_OK | MB_ICONWARNING);
break; break;
case S9X_ERROR: case S9X_ERROR:
fprintf(stderr, "%s\n", str); fprintf(stderr, "%s\n", str);
if(Settings.StopEmulation) if(Settings.StopEmulation)
MessageBox(GUI.hWnd, str, "Error", MB_OK | MB_ICONERROR); MessageBoxA(GUI.hWnd, str, "Error", MB_OK | MB_ICONERROR);
break; break;
case S9X_FATAL_ERROR: case S9X_FATAL_ERROR:
fprintf(stderr, "%s\n", str); fprintf(stderr, "%s\n", str);
if(Settings.StopEmulation) if(Settings.StopEmulation)
MessageBox(GUI.hWnd, str, "Fatal Error", MB_OK | MB_ICONERROR); MessageBoxA(GUI.hWnd, str, "Fatal Error", MB_OK | MB_ICONERROR);
break; break;
default: default:
fprintf(stdout, "%s\n", str); fprintf(stdout, "%s\n", str);
@ -506,24 +477,6 @@ void S9xMessage (int type, int, const char *str)
} }
} }
/*unsigned long _interval = 10;
long _buffernos = 4;
long _blocksize = 4400;
long _samplecount = 440;
long _maxsamplecount = 0;
long _buffersize = 0;
bool StartPlaying = false;
DWORD _lastblock = 0;
bool8 pending_setup = false;
long pending_rate = 0;
bool8 pending_16bit = false;
bool8 pending_stereo = false;*/
extern uint8 *syncSoundBuffer;
//static bool8 block_signal = FALSE;
//static volatile bool8 pending_signal = FALSE;
extern unsigned long START; extern unsigned long START;
void S9xSyncSpeed( void) void S9xSyncSpeed( void)
@ -644,7 +597,7 @@ void S9xSyncSpeed( void)
SkipFrames = Settings.TurboSkipFrames; SkipFrames = Settings.TurboSkipFrames;
else else
SkipFrames = (Settings.SkipFrames == AUTO_FRAMERATE) ? 0 : Settings.SkipFrames; SkipFrames = (Settings.SkipFrames == AUTO_FRAMERATE) ? 0 : Settings.SkipFrames;
if (++IPPU.FrameSkip >= SkipFrames) if (IPPU.FrameSkip++ >= SkipFrames)
{ {
IPPU.FrameSkip = 0; IPPU.FrameSkip = 0;
IPPU.SkippedFrames = 0; IPPU.SkippedFrames = 0;
@ -665,7 +618,7 @@ const char *S9xBasename (const char *f)
return (p + 1); return (p + 1);
#ifdef __DJGPP #ifdef __DJGPP
if (p = strrchr (f, SLASH_CHAR)) if (p = _tcsrchr (f, SLASH_CHAR))
return (p + 1); return (p + 1);
#endif #endif
@ -1004,8 +957,8 @@ void InitSnes9X( void)
// extern FILE *trace; // extern FILE *trace;
// trace = fopen( "SNES9X.TRC", "wt"); // trace = fopen( "SNES9X.TRC", "wt");
freopen( "SNES9X.OUT", "wt", stdout); // freopen( "SNES9X.OUT", "wt", stdout);
freopen( "SNES9X.ERR", "wt", stderr); // freopen( "SNES9X.ERR", "wt", stderr);
// CPU.Flags |= TRACE_FLAG; // CPU.Flags |= TRACE_FLAG;
// APU.Flags |= TRACE_FLAG; // APU.Flags |= TRACE_FLAG;
@ -1035,7 +988,7 @@ void InitSnes9X( void)
S9xGraphicsInit(); S9xGraphicsInit();
InitializeCriticalSection(&GUI.SoundCritSect); InitializeCriticalSection(&GUI.SoundCritSect);
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
S9xInitAPU(); S9xInitAPU();
@ -1163,84 +1116,7 @@ bool JustifierOffscreen()
// } // }
//} //}
#ifdef MK_APU_RESAMPLE void DoAVIOpen(const TCHAR* filename)
void ResampleTo16000HzM16(uint16* input, uint16*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i++)
{
output[i]=(input[i*2]+input[(2*i)+1])>>1;
}
}
void ResampleTo16000HzS16(uint16* input, uint16*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i+=2)
{
output[i]=(input[i*2]+input[(2*(i+1))])>>1;
output[i+1]=(input[(i*2)+1]+input[(2*(i+1))+1])>>1;
}
}
void ResampleTo8000HzM16(uint16* input, uint16*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i++)
{
output[i]=(input[i*4]+input[(4*i)+1]+input[(4*i)+2]+input[(4*i)+3])>>2;
}
}
void ResampleTo8000HzS16(uint16* input, uint16*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i+=2)
{
output[i]=(input[i*4]+input[(4*i)+2]+input[(4*(i+1))]+input[(4*(i+1))+2])>>2;
output[i+1]=(input[(i*4)+1]+input[(4*i)+3]+input[(4*(i+1))+1]+input[(4*(i+1))+3])>>2;
}
}
void ResampleTo16000HzM8(uint8* input, uint8*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i++)
{
output[i]=(input[i*2]+input[(2*i)+1])>>1;
}
}
void ResampleTo16000HzS8(uint8* input, uint8*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i+=2)
{
output[i]=(input[i*2]+input[(2*(i+1))])>>1;
output[i+1]=(input[(i*2)+1]+input[(2*(i+1))+1])>>1;
}
}
void ResampleTo8000HzM8(uint8* input, uint8*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i++)
{
output[i]=(input[i*4]+input[(4*i)+1]+input[(4*i)+2]+input[(4*i)+3])>>2;
}
}
void ResampleTo8000HzS8(uint8* input, uint8*output,int output_samples)
{
int i=0;
for(i=0;i<output_samples;i+=2)
{
output[i]=(input[i*4]+input[(4*i)+2]+input[(4*(i+1))]+input[(4*(i+1))+2])>>2;
output[i+1]=(input[(i*4)+1]+input[(4*i)+3]+input[(4*(i+1))+1]+input[(4*(i+1))+3])>>2;
}
}
#endif
void DoAVIOpen(const char* filename)
{ {
// close current instance // close current instance
if(GUI.AVIOut) if(GUI.AVIOut)
@ -1354,7 +1230,7 @@ void DoAVIClose(int reason)
void DoAVIVideoFrame(SSurface* source_surface, int Width, int Height/*, bool8 sixteen_bit*/) void DoAVIVideoFrame(SSurface* source_surface, int Width, int Height/*, bool8 sixteen_bit*/)
{ {
static uint32 lastFrameCount=0; static uint32 lastFrameCount=0;
if(!GUI.AVIOut || (IPPU.FrameCount==lastFrameCount)) if(!GUI.AVIOut || !avi_buffer || (IPPU.FrameCount==lastFrameCount))
{ {
return; return;
} }

View File

@ -186,6 +186,7 @@
#include "win32_display.h" #include "win32_display.h"
#include "CDirect3D.h" #include "CDirect3D.h"
#include "CDirectDraw.h" #include "CDirectDraw.h"
#include "COpenGL.h"
#include "IS9xDisplayOutput.h" #include "IS9xDisplayOutput.h"
#include "../filter/hq2x.h" #include "../filter/hq2x.h"
@ -194,6 +195,7 @@
// available display output methods // available display output methods
CDirect3D Direct3D; CDirect3D Direct3D;
CDirectDraw DirectDraw; CDirectDraw DirectDraw;
COpenGL OpenGL;
// Interface used to access the display output // Interface used to access the display output
IS9xDisplayOutput *S9xDisplayOutput=&Direct3D; IS9xDisplayOutput *S9xDisplayOutput=&Direct3D;
@ -231,12 +233,16 @@ bool WinDisplayReset(void)
{ {
S9xDisplayOutput->DeInitialize(); S9xDisplayOutput->DeInitialize();
switch(GUI.outputMethod) { switch(GUI.outputMethod) {
default:
case DIRECT3D: case DIRECT3D:
S9xDisplayOutput = &Direct3D; S9xDisplayOutput = &Direct3D;
break; break;
case DIRECTDRAW: case DIRECTDRAW:
S9xDisplayOutput = &DirectDraw; S9xDisplayOutput = &DirectDraw;
break; break;
case OPENGL:
S9xDisplayOutput = &OpenGL;
break;
} }
if(S9xDisplayOutput->Initialize(GUI.hWnd)) { if(S9xDisplayOutput->Initialize(GUI.hWnd)) {
S9xGraphicsDeinit(); S9xGraphicsDeinit();
@ -255,6 +261,58 @@ void WinDisplayApplyChanges()
S9xDisplayOutput->ApplyDisplayChanges(); S9xDisplayOutput->ApplyDisplayChanges();
} }
RECT CalculateDisplayRect(unsigned int sourceWidth,unsigned int sourceHeight,
unsigned int displayWidth,unsigned int displayHeight)
{
float xFactor;
float yFactor;
float minFactor;
float renderWidthCalc,renderHeightCalc;
int hExtend = GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT;
float snesAspect = (float)GUI.AspectWidth/hExtend;
RECT drawRect;
if(GUI.Stretch) {
if(GUI.AspectRatio) {
//fix for hi-res images with FILTER_NONE
//where we need to correct the aspect ratio
renderWidthCalc = (float)sourceWidth;
renderHeightCalc = (float)sourceHeight;
if(renderWidthCalc/renderHeightCalc>snesAspect)
renderWidthCalc = renderHeightCalc * snesAspect;
else if(renderWidthCalc/renderHeightCalc<snesAspect)
renderHeightCalc = renderWidthCalc / snesAspect;
xFactor = (float)displayWidth / renderWidthCalc;
yFactor = (float)displayHeight / renderHeightCalc;
minFactor = xFactor < yFactor ? xFactor : yFactor;
drawRect.right = (LONG)(renderWidthCalc * minFactor);
drawRect.bottom = (LONG)(renderHeightCalc * minFactor);
drawRect.left = (displayWidth - drawRect.right) / 2;
drawRect.top = (displayHeight - drawRect.bottom) / 2;
drawRect.right += drawRect.left;
drawRect.bottom += drawRect.top;
} else {
drawRect.top = 0;
drawRect.left = 0;
drawRect.right = displayWidth;
drawRect.bottom = displayHeight;
}
} else {
drawRect.left = ((int)(displayWidth) - (int)sourceWidth) / 2;
drawRect.top = ((int)(displayHeight) - (int)sourceHeight) / 2;
if(!GUI.AlwaysCenterImage) {
if(drawRect.left < 0) drawRect.left = 0;
if(drawRect.top < 0) drawRect.top = 0;
}
drawRect.right = drawRect.left + sourceWidth;
drawRect.bottom = drawRect.top + sourceHeight;
}
return drawRect;
}
// we no longer support 8bit modes - no palette necessary // we no longer support 8bit modes - no palette necessary
void S9xSetPalette( void) void S9xSetPalette( void)
{ {
@ -266,8 +324,6 @@ bool8 S9xInitUpdate (void)
return (TRUE); return (TRUE);
} }
#define RenderMethod ((Src.Height > SNES_HEIGHT_EXTENDED || Src.Width == 512) ? RenderMethodHiRes : RenderMethod)
// only necessary for avi recording // only necessary for avi recording
// TODO: check if this can be removed // TODO: check if this can be removed
bool8 S9xContinueUpdate(int Width, int Height) bool8 S9xContinueUpdate(int Width, int Height)
@ -319,8 +375,6 @@ bool8 S9xDeinitUpdate (int Width, int Height)
// avi writing // avi writing
DoAVIVideoFrame(&Src, Width, Height); DoAVIVideoFrame(&Src, Width, Height);
GUI.ScreenCleared = true;
SelectRenderMethod (); SelectRenderMethod ();
// Clear some of the old SNES rendered image // Clear some of the old SNES rendered image
@ -402,7 +456,6 @@ static void ClearSurface (LPDIRECTDRAWSURFACE2 lpDDSurface)
void UpdateBackBuffer() void UpdateBackBuffer()
{ {
GUI.ScreenCleared = true;
if (GUI.outputMethod==DIRECTDRAW && GUI.FullScreen) if (GUI.outputMethod==DIRECTDRAW && GUI.FullScreen)
{ {
@ -478,6 +531,24 @@ void RestoreSNESDisplay ()
/* DirectDraw only end */ /* DirectDraw only end */
void SaveMainWinPos()
{
WINDOWPLACEMENT wndPlacement={0};
wndPlacement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(GUI.hWnd,&wndPlacement);
GUI.window_maximized = wndPlacement.showCmd == SW_SHOWMAXIMIZED;
GUI.window_size = wndPlacement.rcNormalPosition;
}
void RestoreMainWinPos()
{
WINDOWPLACEMENT wndPlacement={0};
wndPlacement.length = sizeof(WINDOWPLACEMENT);
wndPlacement.showCmd = GUI.window_maximized?SW_SHOWMAXIMIZED:SW_SHOWNORMAL;
wndPlacement.rcNormalPosition = GUI.window_size;
SetWindowPlacement(GUI.hWnd,&wndPlacement);
}
/* ToggleFullScreen /* ToggleFullScreen
switches between fullscreen and window mode and saves the window position switches between fullscreen and window mode and saves the window position
if EmulateFullscreen is set we simply create a borderless window that spans the screen if EmulateFullscreen is set we simply create a borderless window that spans the screen
@ -491,7 +562,7 @@ void ToggleFullScreen ()
MONITORINFO mi; MONITORINFO mi;
GUI.EmulatedFullscreen = !GUI.EmulatedFullscreen; GUI.EmulatedFullscreen = !GUI.EmulatedFullscreen;
if(GUI.EmulatedFullscreen) { if(GUI.EmulatedFullscreen) {
GetWindowRect (GUI.hWnd, &GUI.window_size); SaveMainWinPos();
if(GetMenu(GUI.hWnd)!=NULL) if(GetMenu(GUI.hWnd)!=NULL)
SetMenu(GUI.hWnd,NULL); SetMenu(GUI.hWnd,NULL);
SetWindowLong (GUI.hWnd, GWL_STYLE, WS_POPUP|WS_VISIBLE); SetWindowLong (GUI.hWnd, GWL_STYLE, WS_POPUP|WS_VISIBLE);
@ -500,40 +571,36 @@ void ToggleFullScreen ()
GetMonitorInfo(hm,&mi); GetMonitorInfo(hm,&mi);
SetWindowPos (GUI.hWnd, HWND_TOP, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top, SWP_DRAWFRAME|SWP_FRAMECHANGED); SetWindowPos (GUI.hWnd, HWND_TOP, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top, SWP_DRAWFRAME|SWP_FRAMECHANGED);
} else { } else {
bool maximized = GUI.window_maximized;
SetWindowLong( GUI.hWnd, GWL_STYLE, WS_POPUPWINDOW|WS_CAPTION| SetWindowLong( GUI.hWnd, GWL_STYLE, WS_POPUPWINDOW|WS_CAPTION|
WS_THICKFRAME|WS_VISIBLE|WS_MINIMIZEBOX|WS_MAXIMIZEBOX); WS_THICKFRAME|WS_VISIBLE|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
SetMenu(GUI.hWnd,GUI.hMenu); SetMenu(GUI.hWnd,GUI.hMenu);
SetWindowPos (GUI.hWnd, HWND_NOTOPMOST, GUI.window_size.left, GUI.window_size.top, GUI.window_size.right - GUI.window_size.left, GUI.window_size.bottom - GUI.window_size.top, SWP_DRAWFRAME|SWP_FRAMECHANGED); SetWindowPos (GUI.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_DRAWFRAME|SWP_FRAMECHANGED);
if(maximized) RestoreMainWinPos();
ShowWindow(GUI.hWnd, SW_MAXIMIZE);
} }
} else { } else {
GUI.FullScreen = !GUI.FullScreen; GUI.FullScreen = !GUI.FullScreen;
if(GUI.FullScreen) { if(GUI.FullScreen) {
GetWindowRect (GUI.hWnd, &GUI.window_size); SaveMainWinPos();
if(GetMenu(GUI.hWnd)!=NULL) if(GetMenu(GUI.hWnd)!=NULL)
SetMenu(GUI.hWnd,NULL); SetMenu(GUI.hWnd,NULL);
SetWindowLong (GUI.hWnd, GWL_STYLE, WS_POPUP|WS_VISIBLE); SetWindowLong (GUI.hWnd, GWL_STYLE, WS_POPUP|WS_VISIBLE);
SetWindowPos (GUI.hWnd, HWND_TOP, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE); SetWindowPos (GUI.hWnd, HWND_TOP, 0, 0, GUI.FullscreenMode.width, GUI.FullscreenMode.height, SWP_DRAWFRAME|SWP_FRAMECHANGED);
if(!S9xDisplayOutput->SetFullscreen(true)) if(!S9xDisplayOutput->SetFullscreen(true))
GUI.FullScreen = false; GUI.FullScreen = false;
} }
if(!GUI.FullScreen) { if(!GUI.FullScreen) {
bool maximized = GUI.window_maximized;
SetWindowLong( GUI.hWnd, GWL_STYLE, WS_POPUPWINDOW|WS_CAPTION| SetWindowLong( GUI.hWnd, GWL_STYLE, WS_POPUPWINDOW|WS_CAPTION|
WS_THICKFRAME|WS_VISIBLE|WS_MINIMIZEBOX|WS_MAXIMIZEBOX); WS_THICKFRAME|WS_VISIBLE|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
SetMenu(GUI.hWnd,GUI.hMenu); SetMenu(GUI.hWnd,GUI.hMenu);
S9xDisplayOutput->SetFullscreen(false); S9xDisplayOutput->SetFullscreen(false);
SetWindowPos (GUI.hWnd, HWND_NOTOPMOST, GUI.window_size.left, GUI.window_size.top, GUI.window_size.right - GUI.window_size.left, GUI.window_size.bottom - GUI.window_size.top, SWP_DRAWFRAME|SWP_FRAMECHANGED); SetWindowPos (GUI.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_DRAWFRAME|SWP_FRAMECHANGED);
if(maximized) RestoreMainWinPos();
ShowWindow(GUI.hWnd, SW_MAXIMIZE);
} }
S9xGraphicsDeinit();
S9xSetWinPixelFormat ();
S9xInitUpdate();
S9xGraphicsInit();
} }
S9xGraphicsDeinit();
S9xSetWinPixelFormat ();
S9xInitUpdate();
S9xGraphicsInit();
IPPU.RenderThisFrame = true; IPPU.RenderThisFrame = true;
S9xClearPause (PAUSE_TOGGLE_FULL_SCREEN); S9xClearPause (PAUSE_TOGGLE_FULL_SCREEN);
@ -687,6 +754,8 @@ void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect)
void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap) void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap)
{ {
if(Settings.StopEmulation)
return;
if(Settings.AutoDisplayMessages) { if(Settings.AutoDisplayMessages) {
WinSetCustomDisplaySurface((void *)GFX.Screen, GFX.RealPPL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, 1); WinSetCustomDisplaySurface((void *)GFX.Screen, GFX.RealPPL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, 1);
WinDisplayStringInBuffer<uint16>(string, linesFromBottom, pixelsFromLeft, allowWrap); WinDisplayStringInBuffer<uint16>(string, linesFromBottom, pixelsFromLeft, allowWrap);
@ -837,7 +906,7 @@ void WinDisplayStringInBuffer (const char *string, int linesFromBottom, int pixe
if (linesFromBottom <= 0) if (linesFromBottom <= 0)
linesFromBottom = 1; linesFromBottom = 1;
screenPtrType *dst = (screenPtrType *)displayScreen + (displayHeight - fontheight_scaled * linesFromBottom) * displayPpl + pixelsFromLeft; screenPtrType *dst = (screenPtrType *)displayScreen + (displayHeight - fontheight_scaled * linesFromBottom) * displayPpl + (int)(pixelsFromLeft * (2*(float)displayWidth/IPPU.RenderedScreenWidth - displayScale));
int len = strlen(string); int len = strlen(string);
int max_chars = displayWidth / (fontwidth_scaled - displayScale); int max_chars = displayWidth / (fontwidth_scaled - displayScale);

View File

@ -182,15 +182,23 @@
#include "render.h" #include "render.h"
#include <vector> #include <vector>
#define IsHiRes(x) ((x.Height > SNES_HEIGHT_EXTENDED || x.Width == 512))
#define RenderMethod (IsHiRes(Src) ? RenderMethodHiRes : RenderMethod)
#define CurrentScale (IsHiRes(Src) ? GUI.ScaleHiRes : GUI.Scale)
void WinRefreshDisplay(void); void WinRefreshDisplay(void);
void S9xSetWinPixelFormat (); void S9xSetWinPixelFormat ();
void SwitchToGDI(); void SwitchToGDI();
void SaveMainWinPos();
void RestoreMainWinPos();
void ToggleFullScreen (); void ToggleFullScreen ();
void RestoreGUIDisplay (); void RestoreGUIDisplay ();
void RestoreSNESDisplay (); void RestoreSNESDisplay ();
void WinChangeWindowSize(unsigned int newWidth, unsigned int newHeight); void WinChangeWindowSize(unsigned int newWidth, unsigned int newHeight);
bool WinDisplayReset(void); bool WinDisplayReset(void);
void WinDisplayApplyChanges(); void WinDisplayApplyChanges();
RECT CalculateDisplayRect(unsigned int sourceWidth,unsigned int sourceHeight,
unsigned int displayWidth,unsigned int displayHeight);
void WinEnumDisplayModes(std::vector<dMode> *modeVector); void WinEnumDisplayModes(std::vector<dMode> *modeVector);
void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect); void ConvertDepth (SSurface *src, SSurface *dst, RECT *srect);
void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap); void WinDisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap);

View File

@ -187,8 +187,12 @@
#pragma comment(linker,"/DEFAULTLIB:fmodvc.lib") #pragma comment(linker,"/DEFAULTLIB:fmodvc.lib")
#elif defined FMODEX_SUPPORT #elif defined FMODEX_SUPPORT
#include "CFMODEx.h" #include "CFMODEx.h"
#if defined(_WIN64)
#pragma comment(linker,"/DEFAULTLIB:fmodex64_vc.lib")
#else
#pragma comment(linker,"/DEFAULTLIB:fmodex_vc.lib") #pragma comment(linker,"/DEFAULTLIB:fmodex_vc.lib")
#endif #endif // _WIN64
#endif // FMODEX_SUPPORT
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
@ -235,6 +239,7 @@ returns true if successful, false otherwise
*/ */
bool8 S9xOpenSoundDevice () bool8 S9xOpenSoundDevice ()
{ {
S9xSetSamplesAvailableCallback (NULL, NULL);
// point the interface to the correct output object // point the interface to the correct output object
switch(GUI.SoundDriver) { switch(GUI.SoundDriver) {
case WIN_SNES9X_DIRECT_SOUND_DRIVER: case WIN_SNES9X_DIRECT_SOUND_DRIVER:
@ -253,7 +258,7 @@ bool8 S9xOpenSoundDevice ()
S9xSoundOutput = &S9xFMODEx; S9xSoundOutput = &S9xFMODEx;
break; break;
#endif #endif
case WIN_XAUDIO2_SOUND_DRIVER: case WIN_XAUDIO2_SOUND_DRIVER:
S9xSoundOutput = &S9xXAudio2; S9xSoundOutput = &S9xXAudio2;
break; break;
default: // we default to DirectSound default: // we default to DirectSound
@ -262,8 +267,12 @@ bool8 S9xOpenSoundDevice ()
} }
if(!S9xSoundOutput->InitSoundOutput()) if(!S9xSoundOutput->InitSoundOutput())
return false; return false;
if(!S9xSoundOutput->SetupSound())
return false;
S9xSetSamplesAvailableCallback (S9xSoundCallback, NULL); S9xSetSamplesAvailableCallback (S9xSoundCallback, NULL);
return S9xSoundOutput->SetupSound(); return true;
} }
/* S9xSoundCallback /* S9xSoundCallback

View File

@ -179,116 +179,116 @@
/* This is where all the GUI text strings will eventually end up */ /* This is where all the GUI text strings will eventually end up */
#define WINDOW_TITLE "Snes9X v%s for Windows" #define WINDOW_TITLE TEXT("Snes9X v1.5X Testing")
// the windows registry is no longer used // the windows registry is no longer used
//#define MY_REG_KEY "Software\\Emulators\\Snes9X" //#define MY_REG_KEY "Software\\Emulators\\Snes9X"
//#define REG_KEY_VER "1.31" //#define REG_KEY_VER "1.31"
#define DISCLAIMER_TEXT "Snes9X v%s for Windows.\r\n" \ #define DISCLAIMER_TEXT TEXT("Snes9X v%s for Windows.\r\n\
"(c) Copyright 1996 - 2002 Gary Henderson and Jerremy Koot (jkoot@snes9x.com)\r\n" \ (c) Copyright 1996 - 2002 Gary Henderson and Jerremy Koot (jkoot@snes9x.com)\r\n\
"(c) Copyright 2002 - 2004 Matthew Kendora\r\n" \ (c) Copyright 2002 - 2004 Matthew Kendora\r\n\
"(c) Copyright 2002 - 2005 Peter Bortas\r\n" \ (c) Copyright 2002 - 2005 Peter Bortas\r\n\
"(c) Copyright 2004 - 2005 Joel Yliluoma\r\n" \ (c) Copyright 2004 - 2005 Joel Yliluoma\r\n\
"(c) Copyright 2001 - 2006 John Weidman\r\n" \ (c) Copyright 2001 - 2006 John Weidman\r\n\
"(c) Copyright 2002 - 2010 Brad Jorsch, funkyass, Kris Bleakley, Nach, zones\r\n" \ (c) Copyright 2002 - 2010 Brad Jorsch, funkyass, Kris Bleakley, Nach, zones\r\n\
"(c) Copyright 2006 - 2007 nitsuja\r\n" \ (c) Copyright 2006 - 2007 nitsuja\r\n\
"(c) Copyright 2009 - 2010 BearOso, OV2\r\n\r\n" \ (c) Copyright 2009 - 2010 BearOso, OV2\r\n\r\n\
"Windows Port Authors: Matthew Kendora, funkyass, nitsuja, Nach, blip, OV2.\r\n\r\n" \ Windows Port Authors: Matthew Kendora, funkyass, nitsuja, Nach, blip, OV2.\r\n\r\n\
"Snes9X is a Super Nintendo Entertainment System\r\n" \ Snes9X is a Super Nintendo Entertainment System\r\n\
"emulator that allows you to play most games designed\r\n" \ emulator that allows you to play most games designed\r\n\
"for the SNES on your PC.\r\n\r\n" \ for the SNES on your PC.\r\n\r\n\
"Please visit http://www.snes9x.com for\r\n" \ Please visit http://www.snes9x.com for\r\n\
"up-to-the-minute information and help on Snes9X.\r\n\r\n" \ up-to-the-minute information and help on Snes9X.\r\n\r\n\
"Nintendo is a trade mark." Nintendo is a trade mark.")
#define APP_NAME "Snes9x" #define APP_NAME TEXT("Snes9x")
// possible global strings // possible global strings
#define SNES9X_INFO "Snes9x: Information" #define SNES9X_INFO TEXT("Snes9x: Information")
#define SNES9X_WARN "Snes9x: WARNING!" #define SNES9X_WARN TEXT("Snes9x: WARNING!")
#define SNES9X_DXS "Snes9X: DirectSound" #define SNES9X_DXS TEXT("Snes9X: DirectSound")
#define SNES9X_SNDQ "Snes9X: Sound CPU Question" #define SNES9X_SNDQ TEXT("Snes9X: Sound CPU Question")
#define SNES9X_NP_ERROR "Snes9X: NetPlay Error" #define SNES9X_NP_ERROR TEXT("Snes9X: NetPlay Error")
#define BUTTON_OK "&OK" #define BUTTON_OK TEXT("&OK")
#define BUTTON_CANCEL "&Cancel" #define BUTTON_CANCEL TEXT("&Cancel")
// Gamepad Dialog Strings // Gamepad Dialog Strings
#define INPUTCONFIG_TITLE "Input Configuration" #define INPUTCONFIG_TITLE TEXT("Input Configuration")
#define INPUTCONFIG_JPTOGGLE "Enabled" #define INPUTCONFIG_JPTOGGLE TEXT("Enabled")
//#define INPUTCONFIG_DIAGTOGGLE "Toggle Diagonals" //#define INPUTCONFIG_DIAGTOGGLE "Toggle Diagonals"
//#define INPUTCONFIG_OK "&OK" //#define INPUTCONFIG_OK "&OK"
//#define INPUTCONFIG_CANCEL "&Cancel" //#define INPUTCONFIG_CANCEL "&Cancel"
#define INPUTCONFIG_JPCOMBO "Joypad #%d" #define INPUTCONFIG_JPCOMBO TEXT("Joypad #%d")
#define INPUTCONFIG_LABEL_UP "Up" #define INPUTCONFIG_LABEL_UP TEXT("Up")
#define INPUTCONFIG_LABEL_DOWN "Down" #define INPUTCONFIG_LABEL_DOWN TEXT("Down")
#define INPUTCONFIG_LABEL_LEFT "Left" #define INPUTCONFIG_LABEL_LEFT TEXT("Left")
#define INPUTCONFIG_LABEL_RIGHT "Right" #define INPUTCONFIG_LABEL_RIGHT TEXT("Right")
#define INPUTCONFIG_LABEL_A "A" #define INPUTCONFIG_LABEL_A TEXT("A")
#define INPUTCONFIG_LABEL_B "B" #define INPUTCONFIG_LABEL_B TEXT("B")
#define INPUTCONFIG_LABEL_X "X" #define INPUTCONFIG_LABEL_X TEXT("X")
#define INPUTCONFIG_LABEL_Y "Y" #define INPUTCONFIG_LABEL_Y TEXT("Y")
#define INPUTCONFIG_LABEL_L "L" #define INPUTCONFIG_LABEL_L TEXT("L")
#define INPUTCONFIG_LABEL_R "R" #define INPUTCONFIG_LABEL_R TEXT("R")
#define INPUTCONFIG_LABEL_START "Start" #define INPUTCONFIG_LABEL_START TEXT("Start")
#define INPUTCONFIG_LABEL_SELECT "Select" #define INPUTCONFIG_LABEL_SELECT TEXT("Select")
#define INPUTCONFIG_LABEL_UPLEFT "Up Left" #define INPUTCONFIG_LABEL_UPLEFT TEXT("Up Left")
#define INPUTCONFIG_LABEL_UPRIGHT "Up Right" #define INPUTCONFIG_LABEL_UPRIGHT TEXT("Up Right")
#define INPUTCONFIG_LABEL_DOWNRIGHT "Dn Right" #define INPUTCONFIG_LABEL_DOWNRIGHT TEXT("Dn Right")
#define INPUTCONFIG_LABEL_DOWNLEFT "Dn Left" #define INPUTCONFIG_LABEL_DOWNLEFT TEXT("Dn Left")
#define INPUTCONFIG_LABEL_BLUE "Blue means the button is already mapped.\nPink means it conflicts with a custom hotkey.\nRed means it's reserved by Windows.\nButtons can be disabled using Escape." #define INPUTCONFIG_LABEL_BLUE TEXT("Blue means the button is already mapped.\nPink means it conflicts with a custom hotkey.\nRed means it's reserved by Windows.\nButtons can be disabled using Escape.")
#define INPUTCONFIG_LABEL_UNUSED "" #define INPUTCONFIG_LABEL_UNUSED TEXT("")
#define INPUTCONFIG_LABEL_CLEAR_TOGGLES_AND_TURBO "Clear All" #define INPUTCONFIG_LABEL_CLEAR_TOGGLES_AND_TURBO TEXT("Clear All")
#define INPUTCONFIG_LABEL_MAKE_TURBO "TempTurbo" #define INPUTCONFIG_LABEL_MAKE_TURBO TEXT("TempTurbo")
#define INPUTCONFIG_LABEL_MAKE_HELD "Autohold" #define INPUTCONFIG_LABEL_MAKE_HELD TEXT("Autohold")
#define INPUTCONFIG_LABEL_MAKE_TURBO_HELD "Autofire" #define INPUTCONFIG_LABEL_MAKE_TURBO_HELD TEXT("Autofire")
#define INPUTCONFIG_LABEL_CONTROLLER_TURBO_PANEL_MOD " Turbo" #define INPUTCONFIG_LABEL_CONTROLLER_TURBO_PANEL_MOD TEXT(" Turbo")
// Hotkeys Dialog Strings // Hotkeys Dialog Strings
#define HOTKEYS_TITLE "Hotkey Configuration" #define HOTKEYS_TITLE TEXT("Hotkey Configuration")
#define HOTKEYS_CONTROL_MOD "Ctrl + " #define HOTKEYS_CONTROL_MOD "Ctrl + "
#define HOTKEYS_SHIFT_MOD "Shift + " #define HOTKEYS_SHIFT_MOD "Shift + "
#define HOTKEYS_ALT_MOD "Alt + " #define HOTKEYS_ALT_MOD "Alt + "
#define HOTKEYS_LABEL_BLUE "Blue means the hotkey is already mapped.\nPink means it conflicts with a game button.\nRed means it's reserved by Windows.\nA hotkey can be disabled using Escape." #define HOTKEYS_LABEL_BLUE TEXT("Blue means the hotkey is already mapped.\nPink means it conflicts with a game button.\nRed means it's reserved by Windows.\nA hotkey can be disabled using Escape.")
#define HOTKEYS_HKCOMBO "Page %d" #define HOTKEYS_HKCOMBO TEXT("Page %d")
#define HOTKEYS_LABEL_1_1 "speed +" #define HOTKEYS_LABEL_1_1 TEXT("speed +")
#define HOTKEYS_LABEL_1_2 "speed -" #define HOTKEYS_LABEL_1_2 TEXT("speed -")
#define HOTKEYS_LABEL_1_3 "pause" #define HOTKEYS_LABEL_1_3 TEXT("pause")
#define HOTKEYS_LABEL_1_4 "frame advance" #define HOTKEYS_LABEL_1_4 TEXT("frame advance")
#define HOTKEYS_LABEL_1_5 "fast forward" #define HOTKEYS_LABEL_1_5 TEXT("fast forward")
#define HOTKEYS_LABEL_1_6 "skip +" #define HOTKEYS_LABEL_1_6 TEXT("skip +")
#define HOTKEYS_LABEL_1_7 "skip -" #define HOTKEYS_LABEL_1_7 TEXT("skip -")
#define HOTKEYS_LABEL_1_8 "superscope turbo" #define HOTKEYS_LABEL_1_8 TEXT("superscope turbo")
#define HOTKEYS_LABEL_1_9 "superscope pause" #define HOTKEYS_LABEL_1_9 TEXT("superscope pause")
#define HOTKEYS_LABEL_1_10 "show pressed keys" #define HOTKEYS_LABEL_1_10 TEXT("show pressed keys")
#define HOTKEYS_LABEL_1_11 "movie frame count" #define HOTKEYS_LABEL_1_11 TEXT("movie frame count")
#define HOTKEYS_LABEL_1_12 "movie read-only" #define HOTKEYS_LABEL_1_12 TEXT("movie read-only")
#define HOTKEYS_LABEL_1_13 "save screenshot" #define HOTKEYS_LABEL_1_13 TEXT("save screenshot")
#define HOTKEYS_LABEL_2_1 "Graphics Layer 1" #define HOTKEYS_LABEL_2_1 TEXT("Graphics Layer 1")
#define HOTKEYS_LABEL_2_2 "Graphics Layer 2" #define HOTKEYS_LABEL_2_2 TEXT("Graphics Layer 2")
#define HOTKEYS_LABEL_2_3 "Graphics Layer 3" #define HOTKEYS_LABEL_2_3 TEXT("Graphics Layer 3")
#define HOTKEYS_LABEL_2_4 "Graphics Layer 4" #define HOTKEYS_LABEL_2_4 TEXT("Graphics Layer 4")
#define HOTKEYS_LABEL_2_5 "Sprites Layer" #define HOTKEYS_LABEL_2_5 TEXT("Sprites Layer")
#define HOTKEYS_LABEL_2_6 "Clipping Windows" #define HOTKEYS_LABEL_2_6 TEXT("Clipping Windows")
#define HOTKEYS_LABEL_2_7 "Transparency" #define HOTKEYS_LABEL_2_7 TEXT("Transparency")
#define HOTKEYS_LABEL_2_8 "HDMA Emulation" #define HOTKEYS_LABEL_2_8 TEXT("HDMA Emulation")
#define HOTKEYS_LABEL_2_9 "GLCube Mode" #define HOTKEYS_LABEL_2_9 TEXT("GLCube Mode")
#define HOTKEYS_LABEL_2_10 "Switch Controllers" #define HOTKEYS_LABEL_2_10 TEXT("Switch Controllers")
#define HOTKEYS_LABEL_2_11 "Joypad Swap" #define HOTKEYS_LABEL_2_11 TEXT("Joypad Swap")
#define HOTKEYS_LABEL_2_12 "Reset Game" #define HOTKEYS_LABEL_2_12 TEXT("Reset Game")
#define HOTKEYS_LABEL_2_13 "Toggle Cheats" #define HOTKEYS_LABEL_2_13 TEXT("Toggle Cheats")
#define HOTKEYS_LABEL_3_1 "Turbo A mode" #define HOTKEYS_LABEL_3_1 TEXT("Turbo A mode")
#define HOTKEYS_LABEL_3_2 "Turbo B mode" #define HOTKEYS_LABEL_3_2 TEXT("Turbo B mode")
#define HOTKEYS_LABEL_3_3 "Turbo Y mode" #define HOTKEYS_LABEL_3_3 TEXT("Turbo Y mode")
#define HOTKEYS_LABEL_3_4 "Turbo X mode" #define HOTKEYS_LABEL_3_4 TEXT("Turbo X mode")
#define HOTKEYS_LABEL_3_5 "Turbo L mode" #define HOTKEYS_LABEL_3_5 TEXT("Turbo L mode")
#define HOTKEYS_LABEL_3_6 "Turbo R mode" #define HOTKEYS_LABEL_3_6 TEXT("Turbo R mode")
#define HOTKEYS_LABEL_3_7 "Turbo Start mode" #define HOTKEYS_LABEL_3_7 TEXT("Turbo Start mode")
#define HOTKEYS_LABEL_3_8 "Turbo Select mode" #define HOTKEYS_LABEL_3_8 TEXT("Turbo Select mode")
#define HOTKEYS_LABEL_3_9 "Turbo Left mode" #define HOTKEYS_LABEL_3_9 TEXT("Turbo Left mode")
#define HOTKEYS_LABEL_3_10 "Turbo Up mode" #define HOTKEYS_LABEL_3_10 TEXT("Turbo Up mode")
#define HOTKEYS_LABEL_3_11 "Turbo Right mode" #define HOTKEYS_LABEL_3_11 TEXT("Turbo Right mode")
#define HOTKEYS_LABEL_3_12 "Turbo Down mode" #define HOTKEYS_LABEL_3_12 TEXT("Turbo Down mode")
//#define HOTKEYS_LABEL_4_12 "Interpolate Mode 7" //#define HOTKEYS_LABEL_4_12 "Interpolate Mode 7"
//#define HOTKEYS_LABEL_4_13 "BG Layering hack" //#define HOTKEYS_LABEL_4_13 "BG Layering hack"
@ -325,7 +325,7 @@
#define GAMEDEVICE_NUMPADPREFIX "Numpad-%c" #define GAMEDEVICE_NUMPADPREFIX "Numpad-%c"
#define GAMEDEVICE_VK_TAB "Tab" #define GAMEDEVICE_VK_TAB "Tab"
#define GAMEDEVICE_VK_BACK "Backspace" #define GAMEDEVICE_VK_BACK "Backspace"
#define GAMEDEVICE_VK_CLEAR "Delete" #define GAMEDEVICE_VK_CLEAR "Clear"
#define GAMEDEVICE_VK_RETURN "Enter" #define GAMEDEVICE_VK_RETURN "Enter"
#define GAMEDEVICE_VK_LSHIFT "LShift" #define GAMEDEVICE_VK_LSHIFT "LShift"
#define GAMEDEVICE_VK_RSHIFT "RShift" #define GAMEDEVICE_VK_RSHIFT "RShift"
@ -449,70 +449,70 @@
//Emulator Settings //Emulator Settings
#define EMUSET_TITLE "Emulation Settings" #define EMUSET_TITLE TEXT("Emulation Settings")
#define EMUSET_LABEL_DIRECTORY "Directory" #define EMUSET_LABEL_DIRECTORY TEXT("Directory")
#define EMUSET_BROWSE "&Browse..." #define EMUSET_BROWSE TEXT("&Browse...")
#define EMUSET_LABEL_ASRAM "Auto-Save S-RAM" #define EMUSET_LABEL_ASRAM TEXT("Auto-Save S-RAM")
#define EMUSET_LABEL_ASRAM_TEXT "seconds after last change (0 disables auto-save)" #define EMUSET_LABEL_ASRAM_TEXT TEXT("seconds after last change (0 disables auto-save)")
#define EMUSET_LABEL_SMAX "Skip at most" #define EMUSET_LABEL_SMAX TEXT("Skip at most")
#define EMUSET_LABEL_SMAX_TEXT "frames in auto-frame rate mode" #define EMUSET_LABEL_SMAX_TEXT TEXT("frames in auto-frame rate mode")
#define EMUSET_LABEL_STURBO "Skip Rendering" #define EMUSET_LABEL_STURBO TEXT("Skip Rendering")
#define EMUSET_LABEL_STURBO_TEXT "frames in fast-forward mode" #define EMUSET_LABEL_STURBO_TEXT TEXT("frames in fast-forward mode")
#define EMUSET_TOGGLE_TURBO "Toggled fast-forward mode" #define EMUSET_TOGGLE_TURBO TEXT("Toggled fast-forward mode")
//Netplay Options //Netplay Options
#define NPOPT_TITLE "Netplay Options" #define NPOPT_TITLE TEXT("Netplay Options")
#define NPOPT_LABEL_PORTNUM "Socket Port Number" #define NPOPT_LABEL_PORTNUM TEXT("Socket Port Number")
#define NPOPT_LABEL_PAUSEINTERVAL "Ask Server to Pause when" #define NPOPT_LABEL_PAUSEINTERVAL TEXT("Ask Server to Pause when")
#define NPOPT_LABEL_PAUSEINTERVAL_TEXT "frames behind" #define NPOPT_LABEL_PAUSEINTERVAL_TEXT TEXT("frames behind")
#define NPOPT_LABEL_MAXSKIP "Maximum Frame Rate Skip" #define NPOPT_LABEL_MAXSKIP TEXT("Maximum Frame Rate Skip")
#define NPOPT_SYNCBYRESET "Sync By Reset" #define NPOPT_SYNCBYRESET TEXT("Sync By Reset")
#define NPOPT_SENDROM "Send ROM Image to Client on Connect" #define NPOPT_SENDROM TEXT("Send ROM Image to Client on Connect")
#define NPOPT_ACTASSERVER "Act As Server" #define NPOPT_ACTASSERVER TEXT("Act As Server")
#define NPOPT_PORTNUMBLOCK "Port Settings" #define NPOPT_PORTNUMBLOCK TEXT("Port Settings")
#define NPOPT_CLIENTSETTINGSBLOCK "Client Settings" #define NPOPT_CLIENTSETTINGSBLOCK TEXT("Client Settings")
#define NPOPT_SERVERSETTINGSBLOCK "Server Settings" #define NPOPT_SERVERSETTINGSBLOCK TEXT("Server Settings")
//Netplay Connect //Netplay Connect
#define NPCON_TITLE "Connect to Server" #define NPCON_TITLE TEXT("Connect to Server")
#define NPCON_LABEL_SERVERADDY "Server Address" #define NPCON_LABEL_SERVERADDY TEXT("Server Address")
#define NPCON_LABEL_PORTNUM "Port Number" #define NPCON_LABEL_PORTNUM TEXT("Port Number")
#define NPCON_CLEARHISTORY "Clear History" #define NPCON_CLEARHISTORY TEXT("Clear History")
#define NPCON_ENTERHOST "enter host name..." #define NPCON_ENTERHOST TEXT("enter host name...")
#define NPCON_PLEASE_ENTERHOST "Please enter a host name." #define NPCON_PLEASE_ENTERHOST TEXT("Please enter a host name.")
//Movie Messages //Movie Messages
#define MOVIE_FILETYPE_DESCRIPTION "Snes9x Movie File" #define MOVIE_FILETYPE_DESCRIPTION TEXT("Snes9x Movie File")
#define MOVIE_LABEL_SYNC_DATA_FROM_MOVIE "LOADED FROM MOVIE:" #define MOVIE_LABEL_SYNC_DATA_FROM_MOVIE TEXT("LOADED FROM MOVIE:")
#define MOVIE_LABEL_SYNC_DATA_NOT_FROM_MOVIE "SETTINGS NOT IN MOVIE; VERIFY:" #define MOVIE_LABEL_SYNC_DATA_NOT_FROM_MOVIE TEXT("SETTINGS NOT IN MOVIE; VERIFY:")
#define MOVIE_ERR_COULD_NOT_OPEN "Could not open movie file." #define MOVIE_ERR_COULD_NOT_OPEN TEXT("Could not open movie file.")
#define MOVIE_ERR_NOT_FOUND_SHORT "File not found." #define MOVIE_ERR_NOT_FOUND_SHORT TEXT("File not found.")
#define MOVIE_ERR_NOT_FOUND "The movie file was not found or could not be opened." #define MOVIE_ERR_NOT_FOUND TEXT("The movie file was not found or could not be opened.")
#define MOVIE_ERR_WRONG_FORMAT_SHORT "Unrecognized format." #define MOVIE_ERR_WRONG_FORMAT_SHORT TEXT("Unrecognized format.")
#define MOVIE_ERR_WRONG_FORMAT "The movie file is corrupt or in the wrong format." #define MOVIE_ERR_WRONG_FORMAT TEXT("The movie file is corrupt or in the wrong format.")
#define MOVIE_ERR_WRONG_VERSION_SHORT "Unsupported movie version." #define MOVIE_ERR_WRONG_VERSION_SHORT TEXT("Unsupported movie version.")
#define MOVIE_ERR_WRONG_VERSION MOVIE_ERR_WRONG_VERSION_SHORT " You need a different version of Snes9x to play this movie." #define MOVIE_ERR_WRONG_VERSION MOVIE_ERR_WRONG_VERSION_SHORT TEXT(" You need a different version of Snes9x to play this movie.")
#define MOVIE_ERR_NOFRAMETOGGLE "No movie; can't toggle frame count" #define MOVIE_ERR_NOFRAMETOGGLE "No movie; can't toggle frame count"
#define MOVIE_ERR_NOREADONLYTOGGLE "No movie; can't toggle read-only" #define MOVIE_ERR_NOREADONLYTOGGLE "No movie; can't toggle read-only"
#define MOVIE_LABEL_AUTHORINFO "Author Info:" #define MOVIE_LABEL_AUTHORINFO TEXT("Author Info:")
#define MOVIE_LABEL_ERRORINFO "Error Info:" #define MOVIE_LABEL_ERRORINFO TEXT("Error Info:")
#define MOVIE_INFO_MISMATCH " <-- MISMATCH !!!" #define MOVIE_INFO_MISMATCH TEXT(" <-- MISMATCH !!!")
#define MOVIE_INFO_CURRENTROM "Current ROM:" #define MOVIE_INFO_CURRENTROM TEXT("Current ROM:")
#define MOVIE_INFO_MOVIEROM "Movie's ROM:" #define MOVIE_INFO_MOVIEROM TEXT("Movie's ROM:")
#define MOVIE_INFO_ROMNOTSTORED " (not stored in movie file)" #define MOVIE_INFO_ROMNOTSTORED TEXT(" (not stored in movie file)")
#define MOVIE_INFO_ROMINFO " crc32=%08X, name=%s" #define MOVIE_INFO_ROMINFO TEXT(" crc32=%08X, name=%s")
#define MOVIE_INFO_DIRECTORY " Path: %s" #define MOVIE_INFO_DIRECTORY TEXT(" Path: %s")
#define MOVIE_WARNING_MISMATCH "WARNING: You don't have the right ROM loaded!" #define MOVIE_WARNING_MISMATCH TEXT("WARNING: You don't have the right ROM loaded!")
#define MOVIE_WARNING_OK "Press OK to start playing the movie." #define MOVIE_WARNING_OK TEXT("Press OK to start playing the movie.")
#define MOVIE_LABEL_STARTSETTINGS "Recording Start" #define MOVIE_LABEL_STARTSETTINGS TEXT("Recording Start")
#define MOVIE_LABEL_CONTSETTINGS "Record Controllers" #define MOVIE_LABEL_CONTSETTINGS TEXT("Record Controllers")
#define MOVIE_LABEL_SYNCSETTINGS "Misc. Recording Settings" #define MOVIE_LABEL_SYNCSETTINGS TEXT("Misc. Recording Settings")
#define MOVIE_SHUTDOWNMASTER_WARNING "The \"SpeedHacks\" setting in your snes9x.cfg file is on.\nThis makes emulation less CPU-intensive, but also less accurate,\ncausing some games to lag noticeably more than they should.\nYou might want to reconsider recording a movie under these conditions." #define MOVIE_SHUTDOWNMASTER_WARNING TEXT("The \"SpeedHacks\" setting in your snes9x.cfg file is on.\nThis makes emulation less CPU-intensive, but also less accurate,\ncausing some games to lag noticeably more than they should.\nYou might want to reconsider recording a movie under these conditions.")
// Save Messages // Save Messages
@ -525,69 +525,71 @@
// Cheat or Cheat Search Messages // Cheat or Cheat Search Messages
#define SEARCH_TITLE_RANGEERROR "Range Error" #define SEARCH_TITLE_RANGEERROR TEXT("Range Error")
#define SEARCH_TITLE_CHEATERROR "Snes9x Cheat Error" #define SEARCH_TITLE_CHEATERROR TEXT("Snes9x Cheat Error")
#define SEARCH_ERR_INVALIDNEWVALUE "You have entered an out of range or invalid value for the new value" #define SEARCH_ERR_INVALIDNEWVALUE TEXT("You have entered an out of range or invalid value for the new value")
#define SEARCH_ERR_INVALIDCURVALUE "You have entered an out of range or invalid value for\n"\ #define SEARCH_ERR_INVALIDCURVALUE TEXT("You have entered an out of range or invalid value for\n\
"the current value. This value is used when a cheat is unapplied.\n"\ the current value. This value is used when a cheat is unapplied.\n\
"(If left blank, no value is restored when the cheat is unapplied)" (If left blank, no value is restored when the cheat is unapplied)")
#define SEARCH_ERR_INVALIDSEARCHVALUE "Please enter a valid value for a search!" #define SEARCH_ERR_INVALIDSEARCHVALUE TEXT("Please enter a valid value for a search!")
#define SEARCH_COLUMN_ADDRESS "Address" #define SEARCH_COLUMN_ADDRESS TEXT("Address")
#define SEARCH_COLUMN_VALUE "Value" #define SEARCH_COLUMN_VALUE TEXT("Value")
#define SEARCH_COLUMN_DESCRIPTION "Description" #define SEARCH_COLUMN_DESCRIPTION TEXT("Description")
// ROM dialog // ROM dialog
#define ROM_COLUMN_FILENAME "File" #define ROM_COLUMN_FILENAME TEXT("File")
#define ROM_COLUMN_DESCRIPTION "Description" #define ROM_COLUMN_DESCRIPTION TEXT("Description")
#define ROM_COLUMN_SIZE "Size" #define ROM_COLUMN_SIZE TEXT("Size")
#define ROM_OPTION_AUTODETECT "Auto-Detect" #define ROM_OPTION_AUTODETECT TEXT("Auto-Detect")
#define ROM_OPTION_FORCEHEADER "Force Header" #define ROM_OPTION_FORCEHEADER TEXT("Force Header")
#define ROM_OPTION_FORCENOHEADER "Force No Header" #define ROM_OPTION_FORCENOHEADER TEXT("Force No Header")
#define ROM_OPTION_FORCEPAL "Force PAL" #define ROM_OPTION_FORCEPAL TEXT("Force PAL")
#define ROM_OPTION_FORCENTSC "Force NTSC" #define ROM_OPTION_FORCENTSC TEXT("Force NTSC")
#define ROM_OPTION_FORCEHIROM "Force HiROM" #define ROM_OPTION_FORCEHIROM TEXT("Force HiROM")
#define ROM_OPTION_FORCELOROM "Force LoROM" #define ROM_OPTION_FORCELOROM TEXT("Force LoROM")
#define ROM_OPTION_NONINTERLEAVED "Force not interleaved" #define ROM_OPTION_NONINTERLEAVED TEXT("Force not interleaved")
#define ROM_OPTION_MODE1 "Force mode 1" #define ROM_OPTION_MODE1 TEXT("Force mode 1")
#define ROM_OPTION_MODE2 "Force mode 2" #define ROM_OPTION_MODE2 TEXT("Force mode 2")
#define ROM_OPTION_GD24 "Force GD24" #define ROM_OPTION_GD24 TEXT("Force GD24")
#define ROM_ITEM_NOTAROM "Not a ROM" #define ROM_ITEM_NOTAROM TEXT("Not a ROM")
#define ROM_ITEM_CANTOPEN "Can't Open File" #define ROM_ITEM_CANTOPEN TEXT("Can't Open File")
#define ROM_ITEM_DESCNOTAVAILABLE "(Not Available)" #define ROM_ITEM_DESCNOTAVAILABLE TEXT("(Not Available)")
#define ROM_ITEM_COMPRESSEDROMDESCRIPTION "" #define ROM_ITEM_COMPRESSEDROMDESCRIPTION TEXT("")
// Settings // Settings
#define SETTINGS_TITLE_SELECTFOLDER "Select Folder" #define SETTINGS_TITLE_SELECTFOLDER TEXT("Select Folder")
#define SETTINGS_OPTION_DIRECTORY_ROMS "Roms" #define SETTINGS_OPTION_DIRECTORY_ROMS TEXT("Roms")
#define SETTINGS_OPTION_DIRECTORY_SCREENS "Screenshots" #define SETTINGS_OPTION_DIRECTORY_SCREENS TEXT("Screenshots")
#define SETTINGS_OPTION_DIRECTORY_MOVIES "Movies" #define SETTINGS_OPTION_DIRECTORY_MOVIES TEXT("Movies")
#define SETTINGS_OPTION_DIRECTORY_SPCS "SPCs" #define SETTINGS_OPTION_DIRECTORY_SPCS TEXT("SPCs")
#define SETTINGS_OPTION_DIRECTORY_SAVES "Saves" #define SETTINGS_OPTION_DIRECTORY_SAVES TEXT("Saves")
#define SETTINGS_OPTION_DIRECTORY_SRAM "SRAM" #define SETTINGS_OPTION_DIRECTORY_SRAM TEXT("SRAM")
#define SETTINGS_OPTION_DIRECTORY_PATCHESANDCHEATS "Patch&Cheat" #define SETTINGS_OPTION_DIRECTORY_PATCHESANDCHEATS TEXT("Patch&Cheat")
#define SETTINGS_OPTION_DIRECTORY_BIOS "BIOS files" #define SETTINGS_OPTION_DIRECTORY_BIOS TEXT("BIOS files")
// Misc. // Misc.
#define INPUT_INFO_DISPLAY_ENABLED "Input display enabled." #define INPUT_INFO_DISPLAY_ENABLED "Input display enabled."
#define INPUT_INFO_DISPLAY_DISABLED "Input display disabled." #define INPUT_INFO_DISPLAY_DISABLED "Input display disabled."
#define FILE_INFO_AVI_FILE_TYPE "AVI file" #define FILE_INFO_AVI_FILE_TYPE TEXT("AVI file")
#define FILE_INFO_TXT_FILE_TYPE "Text file" #define FILE_INFO_TXT_FILE_TYPE TEXT("Text file")
#define FILE_INFO_ROM_FILE_TYPE "ROM files or archives" #define FILE_INFO_ROM_FILE_TYPE TEXT("ROM files or archives")
#define FILE_INFO_UNCROM_FILE_TYPE "Uncompressed ROM files" #define FILE_INFO_UNCROM_FILE_TYPE TEXT("Uncompressed ROM files")
#define FILE_INFO_ANY_FILE_TYPE "All files" #define FILE_INFO_ANY_FILE_TYPE TEXT("All files")
#define ERR_ROM_NOT_FOUND "ROM image \"%s\" was not found or could not be opened." #define ERR_ROM_NOT_FOUND "ROM image \"%s\" was not found or could not be opened."
#define SRM_SAVE_FAILED "Failed to save SRM file." #define SRM_SAVE_FAILED "Failed to save SRM file."
#define INFO_SAVE_SPC "Saving SPC Data."
#define CHEATS_INFO_ENABLED "Cheats enabled." #define CHEATS_INFO_ENABLED "Cheats enabled."
#define CHEATS_INFO_DISABLED "Cheats disabled." #define CHEATS_INFO_DISABLED "Cheats disabled."
#define CHEATS_INFO_ENABLED_NONE "Cheats enabled. (None are active.)" #define CHEATS_INFO_ENABLED_NONE "Cheats enabled. (None are active.)"
#define MULTICART_BIOS_NOT_FOUND "not found!" #define MULTICART_BIOS_NOT_FOUND TEXT("not found!")
#define MULTICART_BIOS_FOUND "" #define MULTICART_BIOS_FOUND TEXT("")
#define ABOUT_DIALOG_TITLE "About " #define ABOUT_DIALOG_TITLE TEXT("About ")

File diff suppressed because it is too large Load Diff

View File

@ -192,6 +192,7 @@
#endif #endif
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <tchar.h>
#include <ddraw.h> #include <ddraw.h>
#include <mmsystem.h> #include <mmsystem.h>
#ifndef __BORLANDC__ #ifndef __BORLANDC__
@ -207,10 +208,18 @@
#define COUNT(a) (sizeof (a) / sizeof (a[0])) #define COUNT(a) (sizeof (a) / sizeof (a[0]))
#define GUI_VERSION 1008 #define GUI_VERSION 1008
extern unsigned char* SoundBuffer;
#define MAX_RECENT_GAMES_LIST_SIZE 32 #define MAX_RECENT_GAMES_LIST_SIZE 32
#define MAX_RECENT_HOSTS_LIST_SIZE 16 #define MAX_RECENT_HOSTS_LIST_SIZE 16
#include "_tfwopen.h"
#ifdef UNICODE
#define _tToChar WideToUtf8
#define _tFromChar Utf8ToWide
#else
#define _tToChar
#define _tFromChar
#endif
/****************************************************************************/ /****************************************************************************/
inline static void Log (const char *str) inline static void Log (const char *str)
{ {
@ -262,7 +271,8 @@ enum RenderFilter{
enum OutputMethod { enum OutputMethod {
DIRECTDRAW = 0, DIRECTDRAW = 0,
DIRECT3D DIRECT3D,
OPENGL
}; };
struct dMode struct dMode
@ -279,7 +289,6 @@ struct sGUI {
HINSTANCE hInstance; HINSTANCE hInstance;
DWORD hFrameTimer; DWORD hFrameTimer;
//DWORD hSoundTimer;
DWORD hHotkeyTimer; DWORD hHotkeyTimer;
HANDLE ClientSemaphore; HANDLE ClientSemaphore;
HANDLE FrameTimerSemaphore; HANDLE FrameTimerSemaphore;
@ -287,22 +296,27 @@ struct sGUI {
BYTE Language; BYTE Language;
//unsigned long PausedFramesBeforeMutingSound; //Graphic Settings
/*int Width;
int Height;
int Depth;
int RefreshRate;*/
dMode FullscreenMode; dMode FullscreenMode;
RenderFilter Scale; RenderFilter Scale;
RenderFilter NextScale;
RenderFilter ScaleHiRes; RenderFilter ScaleHiRes;
RenderFilter NextScaleHiRes;
bool DoubleBuffered; bool DoubleBuffered;
bool FullScreen; bool FullScreen;
bool Stretch; bool Stretch;
bool HeightExtend; bool HeightExtend;
bool AspectRatio; bool AspectRatio;
bool ScreenCleared; OutputMethod outputMethod;
int AspectWidth;
bool AlwaysCenterImage;
bool EmulateFullscreen;
bool EmulatedFullscreen;
bool BilinearFilter;
bool LocalVidMem;
bool Vsync;
bool shaderEnabled;
TCHAR HLSLshaderFileName[MAX_PATH];
TCHAR GLSLshaderFileName[MAX_PATH];
bool IgnoreNextMouseMove; bool IgnoreNextMouseMove;
RECT window_size; RECT window_size;
bool window_maximized; bool window_maximized;
@ -348,46 +362,33 @@ struct sGUI {
int SoundDriver; int SoundDriver;
int SoundBufferSize; int SoundBufferSize;
bool Mute; bool Mute;
// used for sync sound synchronization
CRITICAL_SECTION SoundCritSect;
char RomDir [_MAX_PATH]; TCHAR RomDir [_MAX_PATH];
char ScreensDir [_MAX_PATH]; TCHAR ScreensDir [_MAX_PATH];
char MovieDir [_MAX_PATH]; TCHAR MovieDir [_MAX_PATH];
char SPCDir [_MAX_PATH]; TCHAR SPCDir [_MAX_PATH];
char FreezeFileDir [_MAX_PATH]; TCHAR FreezeFileDir [_MAX_PATH];
char SRAMFileDir [_MAX_PATH]; TCHAR SRAMFileDir [_MAX_PATH];
char PatchDir [_MAX_PATH]; TCHAR PatchDir [_MAX_PATH];
char BiosDir [_MAX_PATH]; TCHAR BiosDir [_MAX_PATH];
bool LockDirectories; bool LockDirectories;
char RecentGames [MAX_RECENT_GAMES_LIST_SIZE][MAX_PATH]; TCHAR RecentGames [MAX_RECENT_GAMES_LIST_SIZE][MAX_PATH];
char RecentHostNames [MAX_RECENT_HOSTS_LIST_SIZE][MAX_PATH]; TCHAR RecentHostNames [MAX_RECENT_HOSTS_LIST_SIZE][MAX_PATH];
//turbo switches -- SNES-wide //turbo switches -- SNES-wide
unsigned short TurboMask; unsigned short TurboMask;
char StarOceanPack[MAX_PATH];
char SFA2PALPack[MAX_PATH];
char SFA2NTSCPack[MAX_PATH];
char SFZ2Pack[MAX_PATH];
char SJNSPack[MAX_PATH];
char FEOEZPack[MAX_PATH];
char SPL4Pack[MAX_PATH];
char MDHPack[MAX_PATH];
COLORREF InfoColor; COLORREF InfoColor;
bool HideMenu; bool HideMenu;
bool BilinearFilter;
bool LocalVidMem;
bool Vsync; // XXX: unused - OV2: used in Direct3D mode
// avi writing // avi writing
struct AVIFile* AVIOut; struct AVIFile* AVIOut;
OutputMethod outputMethod;
int AspectWidth;
bool EmulateFullscreen;
bool EmulatedFullscreen;
long FrameCount; long FrameCount;
long LastFrameCount; long LastFrameCount;
unsigned long IdleCount; unsigned long IdleCount;
// used for sync sound synchronization
CRITICAL_SECTION SoundCritSect;
}; };
//TURBO masks //TURBO masks
@ -559,8 +560,6 @@ enum
#define WIN32_WHITE RGB(255,255,255) #define WIN32_WHITE RGB(255,255,255)
#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b)
/*****************************************************************************/ /*****************************************************************************/
void S9xSetWinPixelFormat (); void S9xSetWinPixelFormat ();
@ -572,5 +571,6 @@ void S9xSetWinPixelFormat ();
const char* GetFilterName(RenderFilter filterID); const char* GetFilterName(RenderFilter filterID);
int GetFilterScale(RenderFilter filterID); int GetFilterScale(RenderFilter filterID);
bool GetFilterHiResSupport(RenderFilter filterID); bool GetFilterHiResSupport(RenderFilter filterID);
const TCHAR * S9xGetDirectoryT (enum s9x_getdirtype);
#endif // !defined(SNES9X_H_INCLUDED) #endif // !defined(SNES9X_H_INCLUDED)

38
win32/zlib/zlib.sln Normal file
View File

@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcproj", "{99E9817A-4605-44AF-8433-7048F0EC1859}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
LIB Debug S9xUnicode|Win32 = LIB Debug S9xUnicode|Win32
LIB Debug S9xUnicode|x64 = LIB Debug S9xUnicode|x64
LIB Debug|Win32 = LIB Debug|Win32
LIB Debug|x64 = LIB Debug|x64
LIB Release S9xUnicode|Win32 = LIB Release S9xUnicode|Win32
LIB Release S9xUnicode|x64 = LIB Release S9xUnicode|x64
LIB Release|Win32 = LIB Release|Win32
LIB Release|x64 = LIB Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug S9xUnicode|Win32.ActiveCfg = LIB Debug S9xUnicode|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug S9xUnicode|Win32.Build.0 = LIB Debug S9xUnicode|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug S9xUnicode|x64.ActiveCfg = LIB Debug S9xUnicode|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug S9xUnicode|x64.Build.0 = LIB Debug S9xUnicode|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug|Win32.ActiveCfg = LIB Debug|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug|Win32.Build.0 = LIB Debug|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug|x64.ActiveCfg = LIB Debug|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Debug|x64.Build.0 = LIB Debug|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release S9xUnicode|Win32.ActiveCfg = LIB Release S9xUnicode|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release S9xUnicode|Win32.Build.0 = LIB Release S9xUnicode|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release S9xUnicode|x64.ActiveCfg = LIB Release S9xUnicode|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release S9xUnicode|x64.Build.0 = LIB Release S9xUnicode|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release|Win32.ActiveCfg = LIB Release|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release|Win32.Build.0 = LIB Release|Win32
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release|x64.ActiveCfg = LIB Release|x64
{99E9817A-4605-44AF-8433-7048F0EC1859}.LIB Release|x64.Build.0 = LIB Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

731
win32/zlib/zlib.vcproj Normal file
View File

@ -0,0 +1,731 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="zlib"
ProjectGUID="{99E9817A-4605-44AF-8433-7048F0EC1859}"
RootNamespace="zlib"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="LIB Debug|Win32"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Debug"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibdmt.pdb"
WarningLevel="3"
DebugInformationFormat="4"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibdmt.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Debug|x64"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Debug_x64"
ConfigurationType="4"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibdmtx64.pdb"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibdmtx64.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Release|Win32"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Release"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibmt.pdb"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibmt.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Release|x64"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Release_x64"
ConfigurationType="4"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibmtx64.pdb"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibmtx64.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Debug S9xUnicode|Win32"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Debug_U"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibdmtu.pdb"
WarningLevel="3"
DebugInformationFormat="4"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibdmtu.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Debug S9xUnicode|x64"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Debug_U_x64"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibdmtux64.pdb"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibdmtux64.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Release S9xUnicode|Win32"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Release_U"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibmtu.pdb"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibmtu.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="LIB Release S9xUnicode|x64"
OutputDirectory="$(SolutionDir)..\..\..\zlib\lib"
IntermediateDirectory="$(OutDir)..\..\..\zlib\lib\ZLIB_Release_U_x64"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(OutDir)\zlibmtux64.pdb"
WarningLevel="3"
DebugInformationFormat="3"
ForcedIncludeFiles="$(SolutionDir)..\_tfwopen.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)\zlibmtux64.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\zlib\adler32.c"
>
</File>
<File
RelativePath="..\..\..\zlib\compress.c"
>
</File>
<File
RelativePath="..\..\..\zlib\crc32.c"
>
</File>
<File
RelativePath="..\..\..\zlib\deflate.c"
>
</File>
<File
RelativePath="..\..\..\zlib\gzio.c"
>
</File>
<File
RelativePath="..\..\..\zlib\infback.c"
>
</File>
<File
RelativePath="..\..\..\zlib\inffast.c"
>
</File>
<File
RelativePath="..\..\..\zlib\inflate.c"
>
</File>
<File
RelativePath="..\..\..\zlib\inftrees.c"
>
</File>
<File
RelativePath="..\..\..\zlib\trees.c"
>
</File>
<File
RelativePath="..\..\..\zlib\uncompr.c"
>
</File>
<File
RelativePath="..\..\..\zlib\win32\zlib.def"
>
<FileConfiguration
Name="LIB Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Debug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Release|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Debug S9xUnicode|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Debug S9xUnicode|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Release S9xUnicode|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="LIB Release S9xUnicode|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\zlib\zutil.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\zlib\crc32.h"
>
</File>
<File
RelativePath="..\..\..\zlib\deflate.h"
>
</File>
<File
RelativePath="..\..\..\zlib\inffast.h"
>
</File>
<File
RelativePath="..\..\..\zlib\inffixed.h"
>
</File>
<File
RelativePath="..\..\..\zlib\inflate.h"
>
</File>
<File
RelativePath="..\..\..\zlib\inftrees.h"
>
</File>
<File
RelativePath="..\..\..\zlib\trees.h"
>
</File>
<File
RelativePath="..\..\..\zlib\zconf.h"
>
</File>
<File
RelativePath="..\..\..\zlib\zlib.h"
>
</File>
<File
RelativePath="..\..\..\zlib\zutil.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\..\..\zlib\win32\zlib1.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>