restructured opengl plugin

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@63 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fires.gc
2008-07-23 15:20:36 +00:00
parent 5955748d58
commit 375b0052e3
58 changed files with 310 additions and 33295 deletions
@@ -18,7 +18,7 @@
#include "Globals.h"
#ifdef _WIN32
#include "svnrev.h"
#include "EmuWindow.h"
#include "OS\Win32.h"
#endif
#include "GLInit.h"
@@ -0,0 +1,153 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "ConfigDlg.h"
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose)
EVT_ACTIVATE(ConfigDialog::ConfigDialogActivate)
EVT_BUTTON(ID_CLOSE,ConfigDialog::OKClick)
EVT_BUTTON(ID_APPLY,ConfigDialog::OKClick)
EVT_BUTTON(ID_OK,ConfigDialog::OKClick)
EVT_BUTTON(ID_BROWSE,ConfigDialog::BrowseClick)
END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
CreateGUIControls();
}
ConfigDialog::~ConfigDialog()
{
}
void ConfigDialog::CreateGUIControls()
{
m_Notebook = new wxNotebook(this, ID_PAGEENHANCEMENTS, wxPoint(0,0),wxSize(484,198));
m_Notebook->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_PageVideo = new wxPanel(m_Notebook, ID_PAGEVIDEO, wxPoint(4,24), wxSize(476,170));
m_PageVideo->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Notebook->AddPage(m_PageVideo, wxT("Video"));
m_PageEnhancements = new wxPanel(m_Notebook, ID_WXNOTEBOOKPAGE3, wxPoint(4,24), wxSize(476,170));
m_PageEnhancements->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Notebook->AddPage(m_PageEnhancements, wxT("Enhancements"));
m_PageAdvanced = new wxPanel(m_Notebook, ID_PAGEADVANCED, wxPoint(4,24), wxSize(476,170));
m_PageAdvanced->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Notebook->AddPage(m_PageAdvanced, wxT("Advanced"));
m_Fullscreen = new wxCheckBox(m_PageVideo, ID_FULLSCREEN, wxT("Fullscreen"), wxPoint(12,16), wxSize(137,25), 0, wxDefaultValidator, wxT("Fullscreen"));
m_Fullscreen->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_RenderToMainWindow = new wxCheckBox(m_PageVideo, ID_RENDERTOMAINWINDOW, wxT("Render to Main Window"), wxPoint(12,40), wxSize(137,25), 0, wxDefaultValidator, wxT("RenderToMainWindow"));
m_RenderToMainWindow->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxArrayString arrayStringFor_FullscreenCB;
m_FullscreenCB = new wxComboBox(m_PageVideo, ID_FULLSCREENCB, wxT("FullscreenCB"), wxPoint(132,72), wxSize(121,21), arrayStringFor_FullscreenCB, 0, wxDefaultValidator, wxT("FullscreenCB"));
m_FullscreenCB->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxArrayString arrayStringFor_WindowResolutionCB;
m_WindowResolutionCB = new wxComboBox(m_PageVideo, ID_WINDOWRESOLUTIONCB, wxT("WxComboBox1"), wxPoint(132,104), wxSize(121,21), arrayStringFor_WindowResolutionCB, 0, wxDefaultValidator, wxT("WindowResolutionCB"));
m_WindowResolutionCB->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxStaticText *WxStaticText1 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT1, wxT("Windowed Resolution:"), wxPoint(12,104), wxDefaultSize, 0, wxT("WxStaticText1"));
WxStaticText1->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxStaticText *WxStaticText2 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT2, wxT("Fullscreen Video Mode:"), wxPoint(12,72), wxDefaultSize, 0, wxT("WxStaticText2"));
WxStaticText2->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxArrayString arrayStringFor_AliasModeCB;
m_AliasModeCB = new wxComboBox(m_PageVideo, ID_ALIASMODECB, wxT("WxComboBox1"), wxPoint(132,136), wxSize(121,21), arrayStringFor_AliasModeCB, 0, wxDefaultValidator, wxT("AliasModeCB"));
m_AliasModeCB->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
wxStaticText *WxStaticText3 = new wxStaticText(m_PageVideo, ID_WXSTATICTEXT3, wxT("Alias Mode:"), wxPoint(12,136), wxDefaultSize, 0, wxT("WxStaticText3"));
WxStaticText3->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_ForceFiltering = new wxCheckBox(m_PageEnhancements, ID_FORCEFILTERING, wxT("Force bi/trlinear (May cause small glitches)"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceFiltering"));
m_ForceFiltering->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_ForceAnsitropy = new wxCheckBox(m_PageEnhancements, ID_FORCEANSITROPY, wxT("Force maximum ansitropy filtering"), wxPoint(12,48), wxSize(233,25), 0, wxDefaultValidator, wxT("ForceAnsitropy"));
m_ForceAnsitropy->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Wireframe = new wxCheckBox(m_PageAdvanced, ID_WIREFRAME, wxT("Wireframe"), wxPoint(12,16), wxSize(233,25), 0, wxDefaultValidator, wxT("Wireframe"));
m_Wireframe->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_DumpTextures = new wxCheckBox(m_PageAdvanced, ID_DUMPTEXTURES, wxT("Dump texture to:"), wxPoint(12,88), wxSize(233,25), 0, wxDefaultValidator, wxT("DumpTextures"));
m_DumpTextures->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Statistics = new wxCheckBox(m_PageAdvanced, ID_STATISTICS, wxT("Overlay some statistics"), wxPoint(12,40), wxSize(233,25), 0, wxDefaultValidator, wxT("Statistics"));
m_Statistics->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_ShaderErrors = new wxCheckBox(m_PageAdvanced, ID_SHADERERRORS, wxT("Show shader compilation issues"), wxPoint(12,64), wxSize(233,25), 0, wxDefaultValidator, wxT("ShaderErrors"));
m_ShaderErrors->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Browse = new wxButton(m_PageAdvanced, ID_BROWSE, wxT("Browse"), wxPoint(156,136), wxSize(65,25), 0, wxDefaultValidator, wxT("Browse"));
m_Browse->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_TexturePath = new wxTextCtrl(m_PageAdvanced, ID_TEXTUREPATH, wxT("TexturePath"), wxPoint(20,136), wxSize(129,25), 0, wxDefaultValidator, wxT("TexturePath"));
m_TexturePath->Enable(false);
m_TexturePath->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_OK = new wxButton(this, ID_OK, wxT("OK"), wxPoint(404,208), wxSize(73,25), 0, wxDefaultValidator, wxT("OK"));
m_OK->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Apply = new wxButton(this, ID_APPLY, wxT("Apply"), wxPoint(324,208), wxSize(73,25), 0, wxDefaultValidator, wxT("Apply"));
m_Apply->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxPoint(244,208), wxSize(73,25), 0, wxDefaultValidator, wxT("Close"));
m_Close->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));
SetTitle(wxT("Opengl Plugin Configuration"));
SetIcon(wxNullIcon);
SetSize(8,8,492,273);
Center();
}
void ConfigDialog::OnClose(wxCloseEvent& /*event*/)
{
EndModal(0);
}
void ConfigDialog::ConfigDialogActivate(wxActivateEvent& event)
{
// init dialog elements from config
}
void ConfigDialog::BrowseClick(wxCommandEvent& event)
{
// browse for folder
}
void ConfigDialog::OKClick(wxCommandEvent& event)
{
if ((event.GetId() == ID_APPLY) ||
(event.GetId() == ID_OK))
{
// update config from dialog
}
if ((event.GetId() == ID_CLOSE) ||
(event.GetId() == ID_OK))
{
EndModal(0);
}
}
@@ -0,0 +1,109 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __CONFIGDIALOG_h__
#define __CONFIGDIALOG_h__
#include <wx/wx.h>
#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#undef ConfigDialog_STYLE
#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigDialog : public wxDialog
{
private:
DECLARE_EVENT_TABLE();
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Opengl Plugin Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = ConfigDialog_STYLE);
virtual ~ConfigDialog();
void ConfigDialogActivate(wxActivateEvent& event);
void BrowseClick(wxCommandEvent& event);
void OKClick(wxCommandEvent& event);
private:
wxButton *m_Close;
wxButton *m_Apply;
wxButton *m_OK;
wxTextCtrl *m_TexturePath;
wxButton *m_Browse;
wxCheckBox *m_ShaderErrors;
wxCheckBox *m_Statistics;
wxCheckBox *m_DumpTextures;
wxCheckBox *m_Wireframe;
wxCheckBox *m_ForceAnsitropy;
wxCheckBox *m_ForceFiltering;
wxComboBox *m_AliasModeCB;
wxComboBox *m_WindowResolutionCB;
wxComboBox *m_FullscreenCB;
wxCheckBox *m_RenderToMainWindow;
wxCheckBox *m_Fullscreen;
wxPanel *m_PageAdvanced;
wxPanel *m_PageEnhancements;
wxPanel *m_PageVideo;
wxNotebook *m_Notebook;
private:
enum
{
////GUI Enum Control ID Start
ID_CLOSE = 1030,
ID_APPLY = 1029,
ID_OK = 1028,
ID_TEXTUREPATH = 1026,
ID_BROWSE = 1025,
ID_SHADERERRORS = 1024,
ID_STATISTICS = 1023,
ID_DUMPTEXTURES = 1022,
ID_WIREFRAME = 1021,
ID_FORCEANSITROPY = 1020,
ID_FORCEFILTERING = 1019,
ID_WXSTATICTEXT3 = 1015,
ID_ALIASMODECB = 1014,
ID_WXSTATICTEXT2 = 1013,
ID_WXSTATICTEXT1 = 1012,
ID_WINDOWRESOLUTIONCB = 1011,
ID_FULLSCREENCB = 1010,
ID_RENDERTOMAINWINDOW = 1009,
ID_FULLSCREEN = 1008,
ID_PAGEADVANCED = 1007,
ID_WXNOTEBOOKPAGE3 = 1006,
ID_PAGEVIDEO = 1005,
ID_PAGEENHANCEMENTS = 1004,
ID_WXNOTEBOOKPAGE1 = 1003,
////GUI Enum Control ID End
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
private:
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif
@@ -77,6 +77,8 @@ void Config::Load()
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Enhancements", "ForceMaxAniso", &bForceMaxAniso, 0);
bFullscreen = true;
}
void Config::Save()
+4 -6
View File
@@ -30,17 +30,15 @@
#include <windowsx.h>
#include <mmsystem.h>
#include "resource.h"
void OpenConsole();
void CloseConsole();
#define GLEW_STATIC
#include "GL/glew.h"
#include "GL/wglew.h"
#include "GL/gl.h"
#include "GL/glext.h"
#include "GLew/glew.h"
#include "GLew/wglew.h"
#include "GLew/gl.h"
#include "GLew/glext.h"
#else // linux basic definitions
@@ -1,104 +0,0 @@
/* GSsoft
* Copyright (C) 2002-2004 GSsoft Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include "GS.h"
extern string s_strIniPath;
void SaveConfig() {
FILE *f;
char cfg[255];
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg,"w");
if (f == NULL) {
printf("failed to open %s\n", s_strIniPath.c_str());
return;
}
fprintf(f, "interlace = %x\n", conf.interlace);
fprintf(f, "aliasing = %x\n", conf.aa);
fprintf(f, "bilinear = %x\n", conf.bilinear);
fprintf(f, "options = %x\n", conf.options);
fprintf(f, "gamesettings = %x\n", conf.gamesettings);
fclose(f);
}
void LoadConfig() {
FILE *f;
char cfg[255];
memset(&conf, 0, sizeof(conf));
conf.interlace = 0; // on, mode 1
conf.mrtdepth = 1;
conf.options = 0;
conf.bilinear = 1;
conf.width = 640;
conf.height = 480;
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "r");
if (f == NULL) {
printf("failed to open %s\n", s_strIniPath.c_str());
SaveConfig();//save and return
return;
}
fscanf(f, "interlace = %x\n", &conf.interlace);
fscanf(f, "aliasing = %x\n", &conf.aa);
fscanf(f, "bilinear = %x\n", &conf.bilinear);
fscanf(f, "options = %x\n", &conf.options);
fscanf(f, "gamesettings = %x\n", &conf.gamesettings);
fclose(f);
// filter bad files
if( conf.aa < 0 || conf.aa > 2 ) conf.aa = 0;
switch(conf.options&GSOPTION_WINDIMS) {
case GSOPTION_WIN640:
conf.width = 640;
conf.height = 480;
break;
case GSOPTION_WIN800:
conf.width = 800;
conf.height = 600;
break;
case GSOPTION_WIN1024:
conf.width = 1024;
conf.height = 768;
break;
case GSOPTION_WIN1280:
conf.width = 1280;
conf.height = 960;
break;
}
// turn off all hacks by defaultof
conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI);
conf.options |= GSOPTION_LOADED;
if( conf.width <= 0 || conf.height <= 0 ) {
conf.width = 640;
conf.height = 480;
}
}
File diff suppressed because it is too large Load Diff
@@ -1,22 +0,0 @@
/*
* Copyright (C) 2002-2004 GSsoft Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LINUX_H__
#define __LINUX_H__
void Show_OGLSettings();
#endif
File diff suppressed because it is too large Load Diff
@@ -19,7 +19,7 @@
#include <windows.h>
#include "../../Core/Src/Core.h"
#include "EmuWindow.h"
#include "Win32.h"
namespace EmuWindow
{
@@ -171,4 +171,15 @@ namespace EmuWindow
rc.bottom = rc.top + h;
::MoveWindow(m_hWnd, rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top, TRUE);
}
}
void SysMessage(char *fmt, ...)
{
va_list list;
char tmp[512];
va_start(list,fmt);
vsprintf(tmp,fmt,list);
va_end(list);
MessageBox(0, tmp, "Video-Plugin", 0);
}
@@ -30,3 +30,5 @@ namespace EmuWindow
void Close();
void SetSize(int displayWidth, int displayHeight);
}
void SysMessage(char *fmt, ...);
@@ -30,7 +30,7 @@
#ifdef _WIN32
#include "EmuWindow.h"
#include "OS\Win32.h"
#else
#endif
@@ -1,281 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "ChunkFile.h"
namespace W32Util
{
ChunkFile::ChunkFile(const TCHAR *filename, bool _read)
{
data=0;
fastMode=false;
if (file.Open(filename,_read ? FILE_READ : FILE_WRITE))
{
didFail=false;
}
else
{
didFail=true;
return;
}
int fSize = file.GetSize();
fastMode = _read ? true : false;
if (fastMode)
{
data = new char[fSize];
file.Read(data,fSize);
file.Close();
}
eof=fSize;
numLevels=0;
read=_read;
pos=0;
didFail=false;
}
ChunkFile::~ChunkFile()
{
if (fastMode && data)
delete [] data;
else
file.Close();
}
int ChunkFile::ReadInt()
{
if (pos<eof)
{
/*
int temp = *(int *)(data+pos);
pos+=4;
*/
pos+=4;
if (fastMode)
return *(int *)(data+pos-4);
else
return file.ReadInt();
}
else
{
return 0;
}
}
void ChunkFile::WriteInt(int i)
{
/*
*(int *)(data+pos) = i;
pos+=4;
*/
file.WriteInt(i);
pos+=4;
}
//let's get into the business
bool ChunkFile::Descend(unsigned int id)
{
id=flipID(id);
if (read)
{
bool found = false;
int startPos = pos;
ChunkInfo temp = stack[numLevels];
//save information to restore after the next Ascend
stack[numLevels].parentStartLocation = pos;
stack[numLevels].parentEOF = eof;
int firstID = 0;
//let's search through children..
while(pos<eof)
{
stack[numLevels].ID = ReadInt();
if (firstID == 0) firstID=stack[numLevels].ID|1;
stack[numLevels].length = ReadInt();
stack[numLevels].startLocation = pos;
if (stack[numLevels].ID == id)
{
found = true;
break;
}
else
{
SeekTo(pos + stack[numLevels].length); //try next block
}
}
//if we found nothing, return false so the caller can skip this
if (!found)
{
/*
pos = startPos;
char temp1[5]; TCHAR temp2[5];
temp1[4]=0; temp2[4]=0;
*(int *)temp1 =id;
TCHAR tempx[256];
for (int i=0; i<4; i++)
temp2[i]=temp1[i];
_stprintf(tempx,TEXT("Couldn't find chunk \"%s\" in file"),temp2);
MessageBox(theApp->getHWND(),tempx,0,0);
*/
stack[numLevels]=temp;
SeekTo(stack[numLevels].parentStartLocation);
return false;
}
//descend into it
//pos was set inside the loop above
eof = stack[numLevels].startLocation + stack[numLevels].length;
numLevels++;
return true;
}
else
{
//write a chunk id, and prepare for filling in length later
WriteInt(id);
WriteInt(0); //will be filled in by Ascend
stack[numLevels].startLocation=pos;
numLevels++;
return true;
}
}
void ChunkFile::SeekTo(int _pos)
{
if (!fastMode)
file.SeekBeg(_pos);
pos=_pos;
}
//let's Ascend out
void ChunkFile::Ascend()
{
if (read)
{
//Ascend, and restore information
numLevels--;
SeekTo(stack[numLevels].parentStartLocation);
eof = stack[numLevels].parentEOF;
}
else
{
numLevels--;
//now fill in the written length automatically
int posNow = pos;
SeekTo(stack[numLevels].startLocation - 4);
WriteInt(posNow-stack[numLevels].startLocation);
SeekTo(posNow);
}
}
//read a block
void ChunkFile::ReadData(void *what, int count)
{
if (fastMode)
memcpy(what,data+pos,count);
else
file.Read(what,count);
pos+=count;
char temp[4]; //discarded
count &= 3;
if (count)
{
count=4-count;
if (!fastMode)
file.Read(temp,count);
pos+=count;
}
}
//write a block
void ChunkFile::WriteData(void *what, int count)
{
/*
memcpy(data+pos,what,count);
pos += count;
*/
file.Write(what,count);
pos+=count;
char temp[5]={0,0,0,0,0};
count &= 3;
if (count)
{
count=4-count;
file.Write(temp,count);
pos+=count;
}
}
/*
void ChunkFile::WriteString(String str)
{
wchar_t *text;
int len=str.length();
#ifdef UNICODE
text = str.getPointer();
#else
text=new wchar_t[len+1];
str.toUnicode(text);
#endif
WriteInt(len);
WriteData((char *)text,len*sizeof(wchar_t));
#ifndef UNICODE
delete [] text;
#endif
}
String ChunkFile::readString()
{
int len=ReadInt();
wchar_t *text = new wchar_t[len+1];
ReadData((char *)text,len*sizeof(wchar_t));
text[len]=0;
#ifdef UNICODE
String s(text);
delete [] text;
return s;
#else
String temp;
temp.fromUnicode(text);
delete [] text;
return temp;
#endif
}
*/
int ChunkFile::GetCurrentChunkSize()
{
if (numLevels)
return stack[numLevels-1].length;
else
return 0;
}
}
@@ -1,78 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "stdafx.h"
//TO REMEMBER WHEN USING:
//EITHER a chunk contains ONLY data
//OR it contains ONLY other chunks
//otherwise the scheme breaks...
#include "File.h"
namespace W32Util
{
inline unsigned int flipID(unsigned int id)
{
return ((id>>24)&0xFF) | ((id>>8)&0xFF00) | ((id<<8)&0xFF0000) | ((id<<24)&0xFF000000);
}
class ChunkFile
{
File file;
struct ChunkInfo
{
int startLocation;
int parentStartLocation;
int parentEOF;
unsigned int ID;
int length;
};
ChunkInfo stack[8];
int numLevels;
char *data;
int pos,eof;
bool fastMode;
bool read;
bool didFail;
void SeekTo(int _pos);
int GetPos() {return pos;}
public:
ChunkFile(const TCHAR *filename, bool _read);
~ChunkFile();
bool Descend(unsigned int id);
void Ascend();
int ReadInt();
void ReadInt(int &i) {i = ReadInt();}
void ReadData(void *data, int count);
// String ReadString();
void WriteInt(int i);
//void WriteString(String str);
void WriteData(void *data, int count);
int GetCurrentChunkSize();
bool Failed() {return didFail;}
};
}
@@ -1,44 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "DialogManager.h"
typedef std::vector <HWND> WindowList;
WindowList dialogs;
void DialogManager::AddDlg(HWND hDialog)
{
dialogs.push_back(hDialog);
}
bool DialogManager::IsDialogMessage(LPMSG message)
{
WindowList::iterator iter;
for (iter=dialogs.begin(); iter!=dialogs.end(); iter++)
{
if (::IsDialogMessage(*iter,message))
return true;
}
return false;
}
void DialogManager::EnableAll(BOOL enable)
{
WindowList::iterator iter;
for (iter=dialogs.begin(); iter!=dialogs.end(); iter++)
EnableWindow(*iter,enable);
}
@@ -1,29 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "stdafx.h"
class DialogManager
{
public:
static void AddDlg(HWND hDialog);
static bool IsDialogMessage(LPMSG message);
static void EnableAll(BOOL enable);
};
@@ -1,195 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include <windowsx.h>
#include "resource.h"
#include "PropertySheet.h"
#include "ShellUtil.h"
#include "Misc.h"
struct TabOGL : public W32Util::Tab
{
void Init(HWND hDlg)
{
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "1X");
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "2X");
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "4X");
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "8X");
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "16X");
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE), g_Config.iMultisampleMode);
//EnableWindow(GetDlgItem(hDlg, IDC_ANTIALIASMODE), FALSE);
for (int i = 0; i < NUMWNDRES; i++)
{
char temp[256];
sprintf(temp,"%ix%i",g_Res[i][0],g_Res[i][1]);
ComboBox_AddString(GetDlgItem(hDlg,IDC_RESOLUTIONWINDOWED),temp);
ComboBox_AddString(GetDlgItem(hDlg,IDC_RESOLUTION), temp);
}
ComboBox_SetCurSel(GetDlgItem(hDlg,IDC_RESOLUTIONWINDOWED),g_Config.iWindowedRes);
ComboBox_SetCurSel(GetDlgItem(hDlg,IDC_RESOLUTION), g_Config.iFSResolution);
CheckDlgButton(hDlg, IDC_FULLSCREENENABLE, g_Config.bFullscreen ? TRUE : FALSE);
CheckDlgButton(hDlg, IDC_RENDER_TO_MAINWINDOW, g_Config.renderToMainframe ? TRUE : FALSE);
}
void Command(HWND hDlg,WPARAM wParam)
{
/*
switch (LOWORD(wParam))
{
default:
break;
}
*/
}
void Apply(HWND hDlg)
{
g_Config.iWindowedRes = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_RESOLUTIONWINDOWED));
g_Config.iMultisampleMode = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE));
g_Config.iFSResolution = ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_RESOLUTION));
g_Config.bFullscreen = Button_GetCheck(GetDlgItem(hDlg, IDC_FULLSCREENENABLE)) ? true : false;
g_Config.renderToMainframe = Button_GetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW)) ? true : false;
g_Config.Save();
}
};
struct TabAdvanced : public W32Util::Tab
{
void Init(HWND hDlg)
{
HWND opt = GetDlgItem(hDlg,IDC_DLOPTLEVEL);
ComboBox_AddString(opt,"0: Interpret (slowest, most compatible)");
ComboBox_AddString(opt,"1: Compile lists and decode vertex lists");
//ComboBox_AddString(opt,"2: Compile+decode to vbufs and use hw xform");
//ComboBox_AddString(opt,"Recompile to vbuffers and shaders");
ComboBox_SetCurSel(opt,g_Config.iCompileDLsLevel);
Button_SetCheck(GetDlgItem(hDlg,IDC_OVERLAYSTATS), g_Config.bOverlayStats);
Button_SetCheck(GetDlgItem(hDlg,IDC_WIREFRAME), g_Config.bWireFrame);
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXDUMP), g_Config.bDumpTextures);
Button_SetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS), g_Config.bShowShaderErrors);
SetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),g_Config.texDumpPath);
Edit_LimitText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),255);
}
void Command(HWND hDlg,WPARAM wParam)
{
switch (LOWORD(wParam))
{
case IDC_BROWSETEXDUMPPATH:
{
std::string path = W32Util::BrowseForFolder(hDlg,"Choose texture dump path:");
SetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),path.c_str());
}
break;
default:
break;
}
}
void Apply(HWND hDlg)
{
g_Config.bOverlayStats = Button_GetCheck(GetDlgItem(hDlg,IDC_OVERLAYSTATS)) ? true : false;
g_Config.bWireFrame = Button_GetCheck(GetDlgItem(hDlg,IDC_WIREFRAME)) ? true : false;
g_Config.bDumpTextures = Button_GetCheck(GetDlgItem(hDlg,IDC_TEXDUMP)) ? true : false;
g_Config.iCompileDLsLevel = (int)ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_DLOPTLEVEL));
g_Config.bShowShaderErrors = Button_GetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS)) ? true : false;
char temp[MAX_PATH];
GetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH), temp, MAX_PATH);
strcpy(g_Config.texDumpPath, temp);
}
};
struct TabDebug : public W32Util::Tab
{
void Init(HWND hDlg)
{
}
void Command(HWND hDlg,WPARAM wParam)
{
/*
switch (LOWORD(wParam))
{
default:
break;
}
*/
}
void Apply(HWND hDlg)
{
}
};
struct TabEnhancements : public W32Util::Tab
{
void Init(HWND hDlg)
{
Button_SetCheck(GetDlgItem(hDlg,IDC_FORCEFILTERING),g_Config.bForceFiltering);
}
void Command(HWND hDlg,WPARAM wParam)
{
/*
switch (LOWORD(wParam))
{
default:
break;
}
*/
}
void Apply(HWND hDlg)
{
g_Config.bForceFiltering = Button_GetCheck(GetDlgItem(hDlg,IDC_FORCEFILTERING)) ? true : false;
}
};
void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
{
g_Config.Load();
W32Util::PropSheet sheet;
sheet.Add(new TabOGL,(LPCTSTR)IDD_SETTINGS,"Direct3D");
sheet.Add(new TabEnhancements,(LPCTSTR)IDD_ENHANCEMENTS,"Enhancements");
sheet.Add(new TabAdvanced,(LPCTSTR)IDD_ADVANCED,"Advanced");
//sheet.Add(new TabDebug,(LPCTSTR)IDD_DEBUGGER,"Debugger");
sheet.Show(hInstance,_hParent,"Graphics Plugin");
g_Config.Save();
}
// Message handler for about box.
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
W32Util::CenterWindow(hDlg);
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
@@ -1,23 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#pragma once
#include "stdafx.h"
void DlgSettings_Show(HINSTANCE hInstance, HWND parent);
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
@@ -1,165 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <stdio.h>
#include <stdlib.h>
#include "File.h"
namespace W32Util
{
File::File()
{
fileHandle = INVALID_HANDLE_VALUE;
isOpen=false;
}
File::~File()
{
}
bool File::Open(const TCHAR *filename, eFileMode _mode)
{
mode = _mode;
//it's time to open the file
fileHandle = CreateFile(filename,
mode==FILE_READ ? GENERIC_READ : GENERIC_WRITE, //open mode
mode == FILE_READ ? FILE_SHARE_READ : NULL, //sharemode
NULL, //security
mode==FILE_READ ? OPEN_EXISTING : CREATE_ALWAYS, //create mode
FILE_ATTRIBUTE_NORMAL, //atrributes
NULL); //template
if (fileHandle == INVALID_HANDLE_VALUE)
isOpen=false;
else
isOpen=true;
return isOpen;
}
void File::Close()
{
if (isOpen)
{
//close the file and reset variables
CloseHandle(fileHandle);
fileHandle=INVALID_HANDLE_VALUE;
isOpen=false;
}
}
int File::GetSize()
{
if (!isOpen) //of course
return 0;
else
return GetFileSize(fileHandle,0);
}
int File::Write(void *data, int size) //let's do some writing
{
if (isOpen)
{
DWORD written;
WriteFile(fileHandle, data, size, &written,0);
return written; //we return the number of bytes that actually got written
}
else
{
return 0;
}
}
int File::Read(void *data, int size)
{
if (isOpen)
{
DWORD wasRead;
ReadFile(fileHandle, data, size, &wasRead,0);
return wasRead; //we return the number of bytes that actually was read
}
else
{
return 0;
}
}
int File::WR(void *data, int size)
{
if (mode==FILE_READ)
return Read(data,size);
else
return Write(data,size);
}
bool File::MagicCookie(int cookie)
{
if (mode==FILE_READ)
{
if (ReadInt()!=cookie)
{
char mojs[5],temp[256];
mojs[4]=0;
*(int*)mojs=cookie;
sprintf(temp,"W32Util::File: Magic Cookie %s is bad!",mojs);
MessageBox(0,temp,"Error reading file",MB_ICONERROR);
return false;
}
else
return true;
}
else if (mode==FILE_WRITE)
{
WriteInt(cookie);
return true;
}
return false;
}
int File::ReadInt()
{
int temp;
if (Read(&temp, sizeof(int)))
return temp;
else
return 0;
}
void File::WriteInt(int i)
{
Write(&i,sizeof(int));
}
char File::ReadChar()
{
char temp;
if (Read(&temp, sizeof(char)))
return temp;
else
return 0;
}
void File::WriteChar(char i)
{
Write(&i,sizeof(char));
}
}
@@ -1,77 +0,0 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __LAMEFILE_H__
#define __LAMEFILE_H__
#include "stdafx.h"
namespace W32Util
{
enum eFileMode
{
FILE_READ=5,
FILE_WRITE=6,
FILE_ERROR=0xff
};
class File
{
HANDLE fileHandle;
eFileMode mode;
bool isOpen;
public:
File();
virtual ~File();
bool Open(const TCHAR *filename, eFileMode mode);
void Adopt(HANDLE h) { fileHandle = h;}
void Close();
void WriteInt(int i);
void WriteChar(char i);
int Write(void *data, int size);
int ReadInt();
char ReadChar();
int Read(void *data, int size);
int WR(void *data, int size); //write or read depending on open mode
bool MagicCookie(int cookie);
int GetSize();
eFileMode GetMode() {return mode;}
void SeekBeg(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
}
void SeekEnd(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
}
void SeekCurrent(int pos)
{
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
}
};
}
#endif //__LAMEFILE_H__

Some files were not shown because too many files have changed in this diff Show More