Glide64: Be able to get texture directory form emulator

This commit is contained in:
zilmar 2013-04-28 15:49:14 +10:00
parent 1088b06a13
commit 6ca28ebe82
22 changed files with 53 additions and 32 deletions

1
.gitignore vendored
View File

@ -68,3 +68,4 @@
/Plugin/GFX/pdb/PJ64Glide64.pdb
/Plugin/GFX/pdb/PJ64Glide64_d.pdb
/Source/Glide64/Glide64.aps
/Textures

View File

@ -20,3 +20,5 @@ Plugin=..\..\Plugin\
Plugin - Use Selected=1
Save=..\..\Save\
Save - Use Selected=1
Texture Dir=..\..\Textures\
Texture Dir - Use Selected=1

View File

@ -24,7 +24,7 @@
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002ini
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007

View File

@ -53,8 +53,7 @@
// begin wxGlade: ::extracode
// end wxGlade
short Set_basic_mode = 0;
short Set_basic_mode = 0, Set_texture_dir = 0;
ConfigNotebook::ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long /*style*/):
wxNotebook(parent, id, pos, size, 0)

View File

@ -284,6 +284,6 @@ enum {
Set_ucodeLookup,
};
extern short Set_basic_mode;
extern short Set_basic_mode, Set_texture_dir;
#endif // CONFIG_H

View File

@ -25,7 +25,7 @@
#include <stdlib.h>
#include "Ext_TxFilter.h"
extern "C" boolean txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, wchar_t *path, wchar_t *ident, dispInfoFuncExt callback);
extern "C" boolean txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, const wchar_t *path, const wchar_t *ident, dispInfoFuncExt callback);
extern "C" void txfilter_shutdown(void);
extern "C" boolean txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat, uint64 g64crc, GHQTexInfo *info);
extern "C" boolean txfilter_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info);
@ -39,7 +39,7 @@ void ext_ghq_shutdown(void)
}
boolean ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
wchar_t *path, wchar_t *ident,
const wchar_t *path, const wchar_t *ident,
dispInfoFuncExt callback)
{
return txfilter_init(maxwidth, maxheight, maxbpp, options, cachesize, path, ident, callback);

View File

@ -168,8 +168,8 @@ boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardwar
int maxbpp, /* maximum texture bpp supported by hardware */
int options, /* options */
int cachesize,/* cache textures to system memory */
wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */
wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */
const wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */
const wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */
dispInfoFuncExt callback /* callback function to display info */
);

View File

@ -146,7 +146,7 @@ extern "C" {
#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
//#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
// "The gfx plugin has caused an exception" instead.
#define FLUSH // flush the file buffer. slower logging, but makes sure

View File

@ -375,6 +375,10 @@ void ReadSettings ()
#ifdef TEXTURE_FILTER
char texture_dir[MAX_PATH];
memset(texture_dir,0,sizeof(texture_dir));
GetSystemSettingSz(Set_texture_dir,texture_dir,sizeof(texture_dir));
settings.texture_dir = texture_dir;
settings.ghq_fltr = (wxUint8)GetSetting(Set_ghq_fltr);
settings.ghq_cmpr = (wxUint8)GetSetting(Set_ghq_cmpr);
settings.ghq_enht = (wxUint8)GetSetting(Set_ghq_enht);
@ -657,8 +661,6 @@ GETTEXADDR GetTexAddr = GetTexAddrNonUMA;
// guLoadTextures - used to load the cursor and font textures
void guLoadTextures ()
{
if (grTextureBufferExt)
{
int tbuf_size = 0;
if (voodoo.max_tex_size <= 256)
{
@ -706,9 +708,6 @@ void guLoadTextures ()
else
offset_texbuf1 = tbuf_size;
}
}
else
offset_font = 0;
#include "font.h"
wxUint32 *data = (wxUint32*)font;
@ -1092,7 +1091,7 @@ int InitGfx ()
voodoo.sup_32bit_tex?32:16, // max texture bpp supported by hardware
options,
settings.ghq_cache_size * 1024*1024, // cache texture to system memory
pluginPath.wchar_str(), // plugin path
stdstr(settings.texture_dir).ToUTF16().c_str(),
rdp.RomName.wchar_str(), // name of ROM. must be no longer than 256 characters
DisplayLoadProgress);
}
@ -1575,6 +1574,7 @@ void CALL PluginLoaded (void)
{
SetModuleName("default");
Set_basic_mode = FindSystemSettingId("Basic Mode");
Set_texture_dir = FindSystemSettingId("Dir:Texture");
SetModuleName("Glide64");
RegisterSetting(Set_CardId, Data_DWORD_General,"card_id",NULL,0l,NULL);

View File

@ -240,6 +240,7 @@ typedef struct {
#ifdef TEXTURE_FILTER
//Texture filtering options
std::string texture_dir;
int ghq_fltr;
int ghq_enht;
int ghq_cmpr;

View File

@ -168,8 +168,8 @@ boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardwar
int maxbpp, /* maximum texture bpp supported by hardware */
int options, /* options */
int cachesize,/* cache textures to system memory */
wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */
wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */
const wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */
const wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */
dispInfoFuncExt callback /* callback function to display info */
);

View File

@ -54,7 +54,7 @@ TxFilter::~TxFilter()
}
TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
int cachesize, wchar_t *path, wchar_t *ident,
int cachesize, const wchar_t *path, const wchar_t *ident,
dispInfoFuncExt callback) :
_numcore(0),
_tex1(NULL),

View File

@ -60,8 +60,8 @@ public:
int maxbpp,
int options,
int cachesize,
wchar_t *path,
wchar_t *ident,
const wchar_t *path,
const wchar_t *ident,
dispInfoFuncExt callback);
boolean filter(uint8 *src,
int srcwidth,

View File

@ -35,7 +35,7 @@ extern "C"{
TAPI boolean TAPIENTRY
txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
wchar_t *path, wchar_t*ident,
const wchar_t *path, const wchar_t*ident,
dispInfoFuncExt callback)
{
if (txFilter) return 0;

View File

@ -153,7 +153,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
INFO(80, L" usage of only 2) and 3) highly recommended!\n");
INFO(80, L" folder names must be in US-ASCII characters!\n");
dir_path.AppendDirectory("hires_texture");
dir_path.AppendDirectory(stdstr().FromUTF16(_ident.c_str()).c_str());
loadHiResTextures(dir_path, replace);
break;

View File

@ -97,6 +97,7 @@ Name: "{app}\Config"; Permissions: users-modify
Name: "{app}\Logs"; Permissions: users-modify
Name: "{app}\Save"; Permissions: users-modify
Name: "{app}\Screenshots"; Permissions: users-modify
Name: "{app}\Textures"; Permissions: users-modify
[Icons]
Name: "{commonprograms}\Project 64 2.0\Project 64"; Filename: "{app}\Project64.exe"

View File

@ -1565,6 +1565,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
case 3: ReadPos += 1; break;
case 6: ReadPos += 1; break;
case 7: ReadPos += 1; break;
case 0x80: ReadPos += 1; break;
default:
g_Notify->BreakPoint(__FILE__,__LINE__);
}

View File

@ -12,7 +12,8 @@
#include "SettingsType-SelectedDirectory.h"
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(LPCSTR Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
m_Name(Name),
m_InitialDir(InitialDir),
m_SelectedDir(SelectedDir),
m_UseSelected(UseSelected)

View File

@ -13,17 +13,20 @@
class CSettingTypeSelectedDirectory :
public CSettingType
{
std::string m_Name;
SettingID m_InitialDir;
SettingID m_SelectedDir;
SettingID m_UseSelected;
public:
CSettingTypeSelectedDirectory(SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
CSettingTypeSelectedDirectory(LPCSTR Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
~CSettingTypeSelectedDirectory();
virtual bool IndexBasedSetting ( void ) const { return false; }
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
LPCSTR GetName ( void ) const { return m_Name.c_str(); }
//return the values
virtual bool Load ( int Index, bool & Value ) const;
virtual bool Load ( int Index, ULONG & Value ) const;

View File

@ -224,34 +224,34 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Directory_RecentGameDirIndex, new CSettingTypeApplicationIndex("Recent Dir","Recent Dir",Default_None));
//Directory_Game,
AddHandler(Directory_Game, new CSettingTypeSelectedDirectory(Directory_GameInitial,Directory_GameSelected,Directory_GameUseSelected));
AddHandler(Directory_Game, new CSettingTypeSelectedDirectory("Dir:Game",Directory_GameInitial,Directory_GameSelected,Directory_GameUseSelected));
AddHandler(Directory_GameInitial, new CSettingTypeRelativePath("Game Directory",""));
AddHandler(Directory_GameSelected, new CSettingTypeApplication("Directory","Game",Directory_GameInitial));
AddHandler(Directory_GameUseSelected, new CSettingTypeApplication("Directory","Game - Use Selected",false));
AddHandler(Directory_Plugin, new CSettingTypeSelectedDirectory(Directory_PluginInitial,Directory_PluginSelected,Directory_PluginUseSelected));
AddHandler(Directory_Plugin, new CSettingTypeSelectedDirectory("Dir:Plugin",Directory_PluginInitial,Directory_PluginSelected,Directory_PluginUseSelected));
AddHandler(Directory_PluginInitial, new CSettingTypeRelativePath("Plugin",""));
AddHandler(Directory_PluginSelected, new CSettingTypeApplicationPath("Directory","Plugin",Directory_PluginInitial));
AddHandler(Directory_PluginUseSelected, new CSettingTypeApplication("Directory","Plugin - Use Selected",false));
AddHandler(Directory_PluginSync, new CSettingTypeRelativePath("SyncPlugin",""));
AddHandler(Directory_SnapShot, new CSettingTypeSelectedDirectory(Directory_SnapShotInitial,Directory_SnapShotSelected,Directory_SnapShotUseSelected));
AddHandler(Directory_SnapShot, new CSettingTypeSelectedDirectory("Dir:Snapshot",Directory_SnapShotInitial,Directory_SnapShotSelected,Directory_SnapShotUseSelected));
AddHandler(Directory_SnapShotInitial, new CSettingTypeRelativePath("Screenshots",""));
AddHandler(Directory_SnapShotSelected, new CSettingTypeApplicationPath("Directory","Snap Shot",Directory_SnapShotInitial));
AddHandler(Directory_SnapShotUseSelected, new CSettingTypeApplication("Directory","Snap Shot - Use Selected",false));
AddHandler(Directory_NativeSave, new CSettingTypeSelectedDirectory(Directory_NativeSaveInitial,Directory_NativeSaveSelected,Directory_NativeSaveUseSelected));
AddHandler(Directory_NativeSave, new CSettingTypeSelectedDirectory("Dir:NativeSave",Directory_NativeSaveInitial,Directory_NativeSaveSelected,Directory_NativeSaveUseSelected));
AddHandler(Directory_NativeSaveInitial, new CSettingTypeRelativePath("Save",""));
AddHandler(Directory_NativeSaveSelected, new CSettingTypeApplicationPath("Directory","Save",Directory_NativeSaveInitial));
AddHandler(Directory_NativeSaveUseSelected,new CSettingTypeApplication("Directory","Save - Use Selected",false));
AddHandler(Directory_InstantSave, new CSettingTypeSelectedDirectory(Directory_InstantSaveInitial,Directory_InstantSaveSelected,Directory_InstantSaveUseSelected));
AddHandler(Directory_InstantSave, new CSettingTypeSelectedDirectory("Dir:InstantSave",Directory_InstantSaveInitial,Directory_InstantSaveSelected,Directory_InstantSaveUseSelected));
AddHandler(Directory_InstantSaveInitial, new CSettingTypeRelativePath("Save",""));
AddHandler(Directory_InstantSaveSelected, new CSettingTypeApplicationPath("Directory","Instant Save",Directory_InstantSaveInitial));
AddHandler(Directory_InstantSaveUseSelected,new CSettingTypeApplication("Directory","Instant Save - Use Selected",false));
AddHandler(Directory_Texture, new CSettingTypeSelectedDirectory(Directory_TextureInitial,Directory_TextureSelected,Directory_TextureUseSelected));
AddHandler(Directory_TextureInitial, new CSettingTypeRelativePath("textures-load",""));
AddHandler(Directory_Texture, new CSettingTypeSelectedDirectory("Dir:Texture",Directory_TextureInitial,Directory_TextureSelected,Directory_TextureUseSelected));
AddHandler(Directory_TextureInitial, new CSettingTypeRelativePath("Textures",""));
AddHandler(Directory_TextureSelected, new CSettingTypeApplicationPath("Directory","Texture Dir",Directory_InstantSaveInitial));
AddHandler(Directory_TextureUseSelected, new CSettingTypeApplication("Directory","Texture Dir - Use Selected",false));
@ -344,6 +344,15 @@ DWORD CSettings::FindSetting ( CSettings * _this, char * Name )
}
return iter->first;
}
if (Setting->GetSettingType() == SettingType_SelectedDirectory)
{
CSettingTypeSelectedDirectory * SelectedDirectory = (CSettingTypeSelectedDirectory *)Setting;
if (_stricmp(SelectedDirectory->GetName(),Name) != 0)
{
continue;
}
return iter->first;
}
}
return 0;
}

View File

@ -110,7 +110,7 @@ BEGIN
EDITTEXT IDC_SNAP_DIR,18,118,170,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_SNAP_DIR,193,118,14,12
GROUPBOX "Texture Directory",IDC_DIR_TEXTURE_FRAME,5,131,208,34
CONTROL "$AppPath\\textures-load\\",IDC_TEXTURE_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,140,179,8
CONTROL "$AppPath\\textures\\",IDC_TEXTURE_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,6,140,179,8
CONTROL "",IDC_TEXTURE_OTHER,"Button",BS_AUTORADIOBUTTON,6,150,11,12
EDITTEXT IDC_TEXTURE_DIR,18,149,170,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_TEXTURE_DIR,193,149,14,12

View File

@ -242,6 +242,10 @@ void FixDirectories ( void )
Directory.UpDirectory();
Directory.AppendDirectory("Screenshots");
if (!Directory.DirectoryExists()) Directory.CreateDirectory();
Directory.UpDirectory();
Directory.AppendDirectory("textures");
if (!Directory.DirectoryExists()) Directory.CreateDirectory();
}
bool TerminatedExistingEmu()