This commit is contained in:
zilmar 2017-03-13 20:36:42 +11:00
commit a0d5ef0cda
29 changed files with 884 additions and 691 deletions

View File

@ -1304,7 +1304,9 @@ Status=Compatible
[17C54A61-4A83F2E7-C:4A]
Good Name=Densha de GO! 64 (J)
Internal Name=ÃÞݼ¬ÃÞGO!64
Save Type=16kbit Eeprom
Status=Compatible
Counter Factor=1
[A5F667E1-DA1FBD1F-C:4A]
Good Name=Derby Stallion 64 (J)
@ -1433,30 +1435,29 @@ Save Type=4kbit Eeprom
Good Name=Donkey Kong 64 (E)
Internal Name=DONKEY KONG 64
Status=Compatible
Core Note=Polygon tearing
Plugin Note=[Glide64] fairy bug; transitions
32bit=No
Counter Factor=1
Culling=1
RDRAM Size=8
Save Type=16kbit Eeprom
Cheat0=806128E2 0000 // Polygon Tearing Fix
[053C89A7-A5064302-C:4A]
Good Name=Donkey Kong 64 (J)
Internal Name=DONKEY KONG 64
Status=Compatible
Core Note=Polygon tearing
Plugin Note=[Glide64] fairy bug; transitions
32bit=No
Counter Factor=1
RDRAM Size=8
Save Type=16kbit Eeprom
Cheat0=806170A2 0000 // Polygon Tearing Fix
[EC58EABF-AD7C7169-C:45]
Good Name=Donkey Kong 64 (U)
Internal Name=DONKEY KONG 64
Status=Compatible
Core Note=Polygon tearing
Plugin Note=[Glide64] fairy bug; transitions
32bit=No
Counter Factor=1
@ -1465,6 +1466,7 @@ Emulate Clear=1
Primary Frame Buffer=1
RDRAM Size=8
Save Type=16kbit Eeprom
Cheat0=80619632 0000 // Polygon Tearing Fix
[0DD4ABAB-B5A2A91E-C:45]
Good Name=Donkey Kong 64 (U) (Kiosk Demo)

View File

@ -4,8 +4,8 @@
//About DLL
#1 # "Japanese" // LANGUAGE ID
#2 # "Nekokabu" // Author
#3 # "2.3.1" // Version
#4 # "2016/10/11" // Date
#3 # "2.3.2" // Version
#4 # "2017/2/9" // Date
//About DLL Dialog
#5 # "現在の言語"
@ -588,3 +588,44 @@ LLE GFXを使用しますか?"
使用しない場合はサウンドが出力されません。
ハイレベルオーディオを使用しますか?"
/*********************************************************************************
* Android *
*********************************************************************************/
#3000# "設定"
#3001# "ヘルプ/掲示板"
#3002# "不具合の報告"
#3003# "About"
#3004# "Recently played"
#3005# "ゲーム"
#3006# "フォルダ"
#3007# "スキャンするフォルダを選択"
#3008# "サブディレクトリを含む"
#3009# "親フォルダ"
#3010# "ディレクトリ"
#3011# "内部メモリ"
#3012# "スキャン中..."
#3013# "OK"
#3014# "キャンセル"
#3015# "情報"
#3016# "Project64 for Android"
#3017# "ライセンス"
#3018# "リビジョン"
#3019# "Project64 for Android\u2122はWindows版Project64のAndroid移植版です。Android\u2122バージョンは、ほとんどのN64ゲームをプレイできます。"
#3020# "Project64 Authors."
//In game menu
#3100# "設定"
#3101# "状態の保存"
#3102# "状態の復元"
#3103# "エミュレーション終了"
#3104# "ポーズ"
#3105# "再開"
#3106# "ゲームスピード"
#3107# "現在のクイックセーブ..."
#3108# "自動"
#3109# "スロット"
#3110# "リセット"
#3111# "デバッグオプション"
#3112# "Reset Function Times"
#3113# "Dump Function Times"

View File

@ -76,7 +76,7 @@ void calc_light(VERTEX *v)
//*
void calc_linear(VERTEX *v)
{
if (g_settings->force_calc_sphere)
if (g_settings->force_calc_sphere())
{
calc_sphere(v);
return;

View File

@ -619,25 +619,7 @@ COMBINE cmb;
cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
percent = (float)(rdp.env_color&0xFF) / 255.0f, \
cmb.dc0_detailmax = cmb.dc1_detailmax = percent
// Bright red, sets up a bright red combine
#ifdef BRIGHT_RED
// Bright red, sets up a bright red combine during the alpha stage
#define BrightRed() { \
CCMB (GR_COMBINE_FUNCTION_LOCAL, \
GR_COMBINE_FACTOR_NONE, \
GR_COMBINE_LOCAL_CONSTANT, \
GR_COMBINE_OTHER_NONE); \
ACMB (GR_COMBINE_FUNCTION_LOCAL, \
GR_COMBINE_FACTOR_NONE, \
GR_COMBINE_LOCAL_CONSTANT, \
GR_COMBINE_OTHER_NONE); \
cmb.ccolor = 0xFF0000FF; \
}
#else
#define BrightRed()
#endif
#define CC(color) cmb.ccolor=(color)&0xFFFFFF00
#define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); }
#define CC_C1MULC2(color1, color2) { \
@ -15659,16 +15641,8 @@ void Combine()
Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7],
Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]);
}
if (g_settings->unk_as_red)
{
BrightRed();
}
else
{
// use full alpha as default
ac_t0();
}
//tex |= 3;
// use full alpha as default
ac_t0();
}
else
{

View File

@ -68,6 +68,7 @@
#include <wtl/atlcrack.h>
extern HINSTANCE hinstDLL;
extern bool g_ghq_use;
extern CriticalSection * g_ProcessDListCS;
@ -106,22 +107,6 @@ void ConfigCleanup(void)
void CloseConfig();
uint32_t texcmpr[] =
{
//NO_COMPRESSION, //"None"
// NCC_COMPRESSION, //"NCC"
S3TC_COMPRESSION, //"S3TC"
FXT1_COMPRESSION, //"FXT1"
};
uint32_t texhirs[] =
{
NO_HIRESTEXTURES, //"Do not use"
RICE_HIRESTEXTURES, //"Rice format"
// GHQ_HIRESTEXTURES, //"GlideHQ format"
// JABO_HIRESTEXTURES, //"Jabo format"
};
#ifdef _WIN32
template < class T, class TT = CToolTipCtrl >
@ -306,11 +291,11 @@ public:
TTSetTxt(IDC_CMB_WINDOW_RES, "Resolution:\n\nThis option selects the windowed resolution.\n\n[Recommended: 640x480, 800x600, 1024x768]");
m_cbxVSync.Attach(GetDlgItem(IDC_CHK_VERTICAL_SYNC));
m_cbxVSync.SetCheck(g_settings->vsync ? BST_CHECKED : BST_UNCHECKED);
m_cbxVSync.SetCheck(g_settings->vsync() ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CHK_VERTICAL_SYNC, "Vertical sync:\n\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\".");
m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT));
m_cbxTextureSettings.SetCheck(g_settings->texenh_options ? BST_CHECKED : BST_UNCHECKED);
m_cbxTextureSettings.SetCheck(g_settings->texenh_options() ? BST_CHECKED : BST_UNCHECKED);
m_cmbFSResolution.Attach(GetDlgItem(IDC_CMB_FS_RESOLUTION));
int32_t size = 0;
@ -321,24 +306,24 @@ public:
{
m_cmbFSResolution.AddString(aRes[r]);
}
m_cmbFSResolution.SetCurSel(g_settings->wrpResolution < size ? g_settings->wrpResolution : 0);
m_cmbFSResolution.SetCurSel(g_settings->FullScreenRes() < size ? g_settings->FullScreenRes() : 0);
}
TTSetTxt(IDC_CMB_FS_RESOLUTION, "Full screen resolution:\n\nThis sets the full screen resolution.\nAll the resolutions that your video card / monitor support should be displayed.\n\n[Recommended:native(max) resolution of your monitor - unless performance becomes an issue]");
m_cbxAnisotropic.Attach(GetDlgItem(IDC_CBXANISOTROPIC));
m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic() ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CBXANISOTROPIC, "Anisotropic filtering:\n\nThis filter sharpens and brings out the details of textures that recede into the distance.\nWhen activated, it will use the max anisotropy your video card supports.\nHowever, this will override native way of texture filtering and may cause visual artifacts in some games.\n\n[Recommended: your preference, game dependant]");
m_cbxFBO.Attach(GetDlgItem(IDC_CHK_USE_FRAME_BUFFER_OBJECT));
TTSetTxt(IDC_CHK_USE_FRAME_BUFFER_OBJECT, "Use frame buffer objects:\n\nChanges the way FB effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension.\nThe choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on.\nAlso, some FB effects works only with one of the methods, no matter, which card you have.\nOn the whole, with FBO off, compatibility/ accuracy is a bit better (which is the case for Resident Evil 2).\nHowever, with FBO on with some systems, it can actually be a bit faster in cases.\n\n[Recommended: video card and game dependant]");
m_cbxFBO.SetCheck(g_settings->wrpFBO > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBO.SetCheck(g_settings->wrpFBO() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxVRAM.Attach(GetDlgItem(IDC_CHK_AUTODETECT_VRAM));
TTSetTxt(IDC_CHK_AUTODETECT_VRAM, "Autodetect VRAM Size:\n\nSince OpenGL cannot do this reliably at the moment, the option to set this manually is available.\nIf checked, plugin will try to autodetect VRAM size.\nBut if this appears wrong, please uncheck and set it to correct value.\n\n[Recommended: on]");
m_VramSize.Attach(GetDlgItem(IDC_SPIN_VRAM_SIZE));
m_VramSize.SetBuddy(GetDlgItem(IDC_TXT_VRAM_SIZE));
m_spinVRAM.Attach(GetDlgItem(IDC_TXT_VRAM_SIZE));
m_cbxVRAM.SetCheck(g_settings->wrpVRAM == 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxVRAM.SetCheck(g_settings->wrpVRAM() == 0 ? BST_CHECKED : BST_UNCHECKED);
m_lblMb.Attach(GetDlgItem(IDC_LBL_MB));
AutoDetectChanged();
return TRUE;
@ -350,12 +335,12 @@ public:
m_spinVRAM.GetWindowText(spinVRAM, sizeof(spinVRAM));
CSettings oldsettings = *g_settings;
g_settings->SetScreenRes(m_WindowRes.GetCurSel());
g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED;
g_settings->texenh_options = m_cbxTextureSettings.GetCheck() == BST_CHECKED;
g_settings->wrpResolution = m_cmbFSResolution.GetCurSel();
g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED;
g_settings->wrpVRAM = m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM);
g_settings->wrpFBO = m_cbxFBO.GetCheck() == BST_CHECKED;
g_settings->SetVsync(m_cbxVSync.GetCheck() == BST_CHECKED);
g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED);
g_settings->SetFullScreenRes(m_cmbFSResolution.GetCurSel());
g_settings->SetWrpAnisotropic(m_cbxAnisotropic.GetCheck() == BST_CHECKED);
g_settings->SetWrpVRAM(m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM));
g_settings->SetWrpFBO(m_cbxFBO.GetCheck() == BST_CHECKED);
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
@ -376,7 +361,7 @@ private:
void AutoDetectChanged(void)
{
m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM ? g_settings->wrpVRAM : 32).c_str());
m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM() != 0 ? g_settings->wrpVRAM() : 32).c_str());
m_spinVRAM.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED);
m_VramSize.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED);
m_lblMb.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED);
@ -476,12 +461,12 @@ public:
tooltip = "Fog enabled:\n\nSets fog emulation on//off.\n\n[Recommended: on]";
TTSetTxt(IDC_CHK_FOG, tooltip.c_str());
m_cbxFog.Attach(GetDlgItem(IDC_CHK_FOG));
m_cbxFog.SetCheck(g_settings->fog > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFog.SetCheck(g_settings->fog() > 0 ? BST_CHECKED : BST_UNCHECKED);
tooltip = "Buffer clear on every frame:\n\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated, and some garbage may be left on the screen.\nIn such cases, this option must be set on.\n\n[Recommended: on]";
TTSetTxt(IDC_CHK_BUFFER_CLEAR, tooltip.c_str());
m_cbxBuffer.Attach(GetDlgItem(IDC_CHK_BUFFER_CLEAR));
m_cbxBuffer.SetCheck(g_settings->buff_clear > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxBuffer.SetCheck(g_settings->buff_clear() ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBEnable.Attach(GetDlgItem(IDC_CHK_FRAME_BUFFER_EMULATION));
TTSetTxt(IDC_CHK_FRAME_BUFFER_EMULATION, "Enable frame buffer emulation:\n\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n\n[Recommended: on for games which use frame buffer effects]");
@ -520,8 +505,8 @@ public:
g_settings->SetFiltering((CSettings::Filtering_t)m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel()));
g_settings->SetAspectmode((CSettings::AspectMode_t)m_cmbAspect.GetItemData(m_cmbAspect.GetCurSel()));
g_settings->SetSwapMode((CSettings::SwapMode_t)m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel()));
g_settings->fog = m_cbxFog.GetCheck() == BST_CHECKED;
g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED;
g_settings->SetFog(m_cbxFog.GetCheck() == BST_CHECKED);
g_settings->SetBuffClear(m_cbxBuffer.GetCheck() == BST_CHECKED);
g_settings->SetLODmode((CSettings::PixelLevelOfDetail_t)m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel()));
CButton * fb_buttons[] =
@ -628,72 +613,72 @@ public:
TTSetTxt(IDC_TXT_FORMAT_CHOICES, tooltip.c_str());
TTSetTxt(IDC_CMB_FORMAT_CHOICES, tooltip.c_str());
m_cmbHrsFormat.Attach(GetDlgItem(IDC_CMB_FORMAT_CHOICES));
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), 0);
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), 1);
SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs);
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), CSettings::HiResPackFormat_None);
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), CSettings::HiResPackFormat_Riceformat);
SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs());
m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD));
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0);
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), 1);
SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr);
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), CSettings::TextureCompression_S3TC);
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), CSettings::TextureCompression_FXT1);
SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr());
tooltip = "Texture cache size:\n\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures, so setting 256+ megs can boost performance.\nAdjust accordingly if you are encountering speed issues.\n'0' disables cache.\n\n[Recommended: PC and game dependant]";
TTSetTxt(IDC_TXT_TEXTURE_CACHE, tooltip.c_str());
TTSetTxt(IDC_SPIN_TEXTURE_CACHE, tooltip.c_str());
TTSetTxt(IDC_TEXT_MB, tooltip.c_str());
m_textTexCache.Attach(GetDlgItem(IDC_TXT_TEXTURE_CACHE));
m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size).c_str());
m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size()).c_str());
m_spinEnhCacheSize.Attach(GetDlgItem(IDC_SPIN_TEXTURE_CACHE));
m_spinEnhCacheSize.SetBuddy(m_textTexCache);
TTSetTxt(IDC_CHK_IGNORE_BACKGROUND, "Ignore Backgrounds:\n\nIt is used to skip enhancement for long narrow textures, usually used for backgrounds.\nThis may save texture memory greatly and increase performance.\n\n[Recommended: on (off for 'Store' mode)]");
m_cbxEnhIgnoreBG.Attach(GetDlgItem(IDC_CHK_IGNORE_BACKGROUND));
m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg() > 0 ? BST_CHECKED : BST_UNCHECKED);
tooltip = "Texture compression:\n\nTextures will be compressed using selected texture compression method.\nThe overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC.\nIn addition to saving space on the texture cache, the space occupied on the GFX hardware's texture RAM, by the enhanced textures, will be greatly reduced.\nThis minimizes texture RAM usage, decreasing the number of texture swaps to the GFX hardware leading to performance gains.\nHowever, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures.\n\n[Recommended: off]";
TTSetTxt(IDC_CHK_TEX_COMPRESSION, tooltip.c_str());
TTSetTxt(IDC_CHK_HIRES_TEX_COMPRESSION, tooltip.c_str());
m_cbxEnhTexCompression.Attach(GetDlgItem(IDC_CHK_TEX_COMPRESSION));
m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexCompression.Attach(GetDlgItem(IDC_CHK_HIRES_TEX_COMPRESSION));
m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr() ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CHK_COMPRESS_CACHE, "Compress texture cache:\n\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]");
m_cbxEnhCompressCache.Attach(GetDlgItem(IDC_CHK_COMPRESS_CACHE));
m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTile.Attach(GetDlgItem(IDC_CHK_TILE_TEX));
TTSetTxt(IDC_CHK_TILE_TEX, "Tile textures:\n\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet - various issues are possible, including black lines and polygons distortions.\n\n[Recommended: off]");
m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile() ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsForce16.Attach(GetDlgItem(IDC_CHK_FORCE_16BPP_TEXT));
TTSetTxt(IDC_CHK_FORCE_16BPP_TEXT, "Force 16bpp textures:\n\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n\n[Recommended: off]");
m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_f16bpp() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexEdit.Attach(GetDlgItem(IDC_CHK_TEX_DUMP_EDIT));
TTSetTxt(IDC_CHK_TEX_DUMP_EDIT, "Texture dumping mode:\n\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys:\n\"R\" reloads hires textures from the texture pack\n\"D\" toggles texture dumps on/off.");
m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsAltCRC.Attach(GetDlgItem(IDC_CHK_ALT_CRC));
TTSetTxt(IDC_CHK_ALT_CRC, "Alternative CRC calculation:\n\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n\n[Recommended: texture pack dependant, mostly on]");
m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc > 0 ? BST_CHECKED : BST_UNCHECKED);
if (g_settings->ghq_hirs_dump)
m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc() > 0 ? BST_CHECKED : BST_UNCHECKED);
if (g_settings->ghq_hirs_dump())
{
m_cbxHrsAltCRC.EnableWindow(false);
}
m_cbxHrsCompressCache.Attach(GetDlgItem(IDC_CHK_HRS_COMPRESS_CACHE));
TTSetTxt(IDC_CHK_HRS_COMPRESS_CACHE, "Compress texture cache:\n\nWhen game started, plugin loads all its hi-resolution textures into PC memory.\nSince hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory.\nCache compression allows save memory space greatly.\nTextures will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]");
m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsLetFly.Attach(GetDlgItem(IDC_CHK_USE_ALPHA_FULLY));
TTSetTxt(IDC_CHK_USE_ALPHA_FULLY, "Use Alpha channel fully:\n\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style, with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture, and select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need, regardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n\n[Recommended: texture pack dependant]");
m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxSaveTexCache.Attach(GetDlgItem(IDC_CHK_TEX_CACHE_HD));
TTSetTxt(IDC_CHK_TEX_CACHE_HD, "Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 to 60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Textures folder.\n\n[Highly Recommended: on]");
m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save() > 0 ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
}
@ -705,20 +690,20 @@ public:
CSettings oldsettings = *g_settings;
g_settings->SetGhqFltr((CSettings::TextureFilter_t)m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel()));
g_settings->SetGhqEnht((CSettings::TextureEnhancement_t)m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel()));
g_settings->ghq_cache_size = atoi(texcache);
g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED;
g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED;
g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs = m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel());
g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_cmpr = (int)m_cbxHrsTexCompression.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_gz = (int)m_cbxHrsCompressCache.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED;
g_settings->ghq_cmpr = (int)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel());
g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED;
g_settings->SetGhqCacheSize(atoi(texcache));
g_settings->SetGhqEnhtNobg(m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED);
g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED);
g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel()));
g_settings->SetGhqHirsTile(m_cbxHrsTile.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsF16bpp(m_cbxHrsForce16.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsDump(m_cbxHrsTexEdit.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsAltcrc(m_cbxHrsAltCRC.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsLetTexartistsFly(m_cbxHrsLetFly.GetCheck() == BST_CHECKED);
g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel()));
g_settings->SetGhqCacheSave(m_cbxSaveTexCache.GetCheck() == BST_CHECKED);
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
g_settings->WriteSettings();
@ -757,7 +742,7 @@ COptionsSheet::COptionsSheet(_U_STRINGorID /*title*/, UINT /*uStartPage*/, HWND
m_hTextureEnhancement(0)
{
AddPage(&m_pgBasicPage->m_psp);
if (g_settings->advanced_options)
if (g_settings->advanced_options())
{
AddPage(&m_pgEmuSettings->m_psp);
}
@ -773,7 +758,7 @@ COptionsSheet::~COptionsSheet()
void COptionsSheet::UpdateTextureSettings(void)
{
if (g_settings->texenh_options)
if (g_settings->texenh_options())
{
if (m_hTextureEnhancement == NULL)
{
@ -807,15 +792,15 @@ void CALL DllConfig(HWND hParent)
if (g_romopen)
{
if (evoodoo)// && g_fullscreen && !ev_fullscreen)
if (evoodoo)// && fullscreen && !ev_fullscreen)
{
ReleaseGfx();
rdp_reset();
}
if (g_settings->ghq_use)
if (g_ghq_use)
{
ext_ghq_shutdown();
g_settings->ghq_use = 0;
g_ghq_use = false;
}
}
else
@ -887,18 +872,3 @@ void CALL DllAbout(HWND /*hParent*/)
dlg.DoModal();
#endif
}
void general_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_General, name, NULL, value, NULL);
}
void game_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL);
}
void game_setting_default(short setting_ID, const char * name, short default_setting)
{
RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting);
}

View File

@ -47,9 +47,3 @@
void ConfigInit(HINSTANCE hinst);
void ConfigCleanup(void);
#endif
extern void general_setting(short setting_ID, const char * name, unsigned int value);
extern void game_setting(short setting_ID, const char * name, unsigned int value);
extern void game_setting_default(short setting_ID, const char * name, short default_setting);

View File

@ -70,7 +70,6 @@ the plugin
#include <stddef.h> // offsetof
#include <glide.h>
#include <Common/MemTest.h>
#include <Settings/Settings.h>
#include "GlideExtensions.h"
#include "rdp.h"
#include "Config.h"
@ -103,17 +102,9 @@ extern "C" {
// ********************************
#define LOGNOTKEY // Log if not pressing:
#define LOGKEY 0x11 // this key (CONTROL)
#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
// "The gfx plugin has caused an exception" instead.
#define FLUSH // flush the file buffer. slower logging, but makes sure
// the command is logged before continuing (in case of
// crash or exception, the log will not be cut short)
#ifndef _ENDUSER_RELEASE_
#endif
@ -129,22 +120,12 @@ extern "C" {
//#define SIMULATE_BANSHEE
//********
#ifndef _ENDUSER_RELEASE_
#define BRIGHT_RED // Keep enabled, option in dialog
#endif
#define COLORED_DEBUGGER // ;) pretty colors
// rdram mask at 0x400000 bytes (bah, not right for majora's mask)
//#define BMASK 0x7FFFFF
extern unsigned int BMASK;
#define WMASK 0x3FFFFF
#define DMASK 0x1FFFFF
extern uint32_t update_screen_count;
int CheckKeyPressed(int key, int mask);
//#define PERFORMANCE
#ifdef PERFORMANCE
extern int64 perf_cur;
@ -277,8 +258,6 @@ extern "C" {
typedef int(*GETTEXADDR)(int tmu, int texsize);
extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
#ifndef GR_STIPPLE_DISABLE

View File

@ -41,7 +41,6 @@
#include <Common/StdString.h>
#include "Gfx_1.3.h"
#include "Version.h"
#include <Settings/Settings.h>
#include <Common/CriticalSection.h>
#include <Common/DateTimeClass.h>
#include <Common/path.h>
@ -82,7 +81,7 @@ int exception = FALSE;
int evoodoo = 0;
int ev_fullscreen = 0;
extern int viewport_offset;
extern int g_viewport_offset;
extern int g_width, g_height;
@ -115,8 +114,9 @@ uint32_t offset_cursor = 0;
uint32_t offset_textures = 0;
uint32_t offset_texbuf1 = 0;
int capture_screen = 0;
std::string capture_path;
bool g_ghq_use = false;
bool g_capture_screen = false;
std::string g_capture_path;
#ifdef _WIN32
HWND g_hwnd_win = NULL;
@ -156,13 +156,13 @@ void _ChangeSize()
rdp.vi_width = (hend - hstart) * fscale_x;
rdp.vi_height = (vend - vstart) * fscale_y * 1.0126582f;
float aspect = (g_settings->adjust_aspect && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f;
float aspect = (g_settings->adjust_aspect() && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f;
WriteTrace(TraceResolution, TraceDebug, "hstart: %d, hend: %d, vstart: %d, vend: %d", hstart, hend, vstart, vend);
WriteTrace(TraceResolution, TraceDebug, "size: %d x %d", (int)rdp.vi_width, (int)rdp.vi_height);
rdp.scale_x = (float)g_settings->res_x() / rdp.vi_width;
if (region > 0 && g_settings->pal230)
if (region > 0 && g_settings->pal230())
{
// odd... but pal games seem to want 230 as height...
rdp.scale_y = res_scl_y * (230.0f / rdp.vi_height) * aspect;
@ -204,20 +204,11 @@ void ChangeSize()
void ConfigWrapper()
{
grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic());
}
void UseUnregisteredSetting(int /*SettingID*/)
{
#ifdef _WIN32
DebugBreak();
#endif
}
extern int g_width, g_height;
GRSTIPPLE grStippleModeExt = NULL;
GRSTIPPLE grStipplePatternExt = NULL;
int GetTexAddrUMA(int /*tmu*/, int texsize)
{
int addr = voodoo.tex_min_addr[0] + voodoo.tmem_ptr[0];
@ -383,9 +374,12 @@ void DisplayLoadProgress(const wchar_t *format, ...)
#ifdef _WIN32
void SetWindowDisplaySize(HWND hWnd)
{
if ((HWND)hWnd == NULL) hWnd = GetActiveWindow();
if (hWnd == NULL)
{
hWnd = GetActiveWindow();
}
g_hwnd_win = (HWND)hWnd;
if (ev_fullscreen)
{
ZeroMemory(&g_windowedRect, sizeof(RECT));
@ -395,7 +389,7 @@ void SetWindowDisplaySize(HWND hWnd)
g_windowedStyle = GetWindowLong(hWnd, GWL_STYLE);
// primary monitor only
if (!EnterFullScreen(g_settings->wrpResolution))
if (!EnterFullScreen(g_settings->FullScreenRes()))
{
WriteTrace(TraceGlitch, TraceWarning, "can't change to fullscreen mode");
}
@ -410,7 +404,7 @@ void SetWindowDisplaySize(HWND hWnd)
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
SetWindowPos(hWnd, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
viewport_offset = 0;
g_viewport_offset = 0;
g_fullscreen = true;
}
else
@ -430,7 +424,7 @@ void SetWindowDisplaySize(HWND hWnd)
{
GetWindowRect(hStatusBar, &statusbarRect);
}
viewport_offset = statusbarRect.bottom - statusbarRect.top;
g_viewport_offset = statusbarRect.bottom - statusbarRect.top;
GetWindowRect(hWnd, &g_windowedRect);
GetClientRect(hWnd, &clientRect);
g_windowedRect.right += (g_width - (clientRect.right - clientRect.left));
@ -455,6 +449,9 @@ void ExitFullScreen(void)
}
#endif
void setPattern();
int InitGfx()
{
if (GfxInitDone)
@ -571,11 +568,8 @@ int InitGfx()
if (strstr(extensions, "GETGAMMA"))
grGet(GR_GAMMA_TABLE_ENTRIES, sizeof(voodoo.gamma_table_size), &voodoo.gamma_table_size);
grStippleModeExt = (GRSTIPPLE)grStippleMode;
grStipplePatternExt = (GRSTIPPLE)grStipplePattern;
if (grStipplePatternExt)
grStipplePatternExt(g_settings->stipple_pattern);
srand(g_settings->stipple_pattern());
setPattern();
InitCombine();
@ -599,7 +593,7 @@ int InitGfx()
grCullMode(GR_CULL_NEGATIVE);
if (g_settings->fog) //"FOGCOORD" extension
if (g_settings->fog()) //"FOGCOORD" extension
{
if (strstr(extensions, "FOGCOORD"))
{
@ -622,7 +616,9 @@ int InitGfx()
grVertexLayout(GR_PARAM_FOG_EXT, offsetof(VERTEX, f), GR_PARAM_ENABLE);
}
else //not supported
g_settings->fog = FALSE;
{
g_settings->SetFog(FALSE);
}
}
grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
@ -651,65 +647,65 @@ int InitGfx()
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
if (!g_settings->ghq_use)
if (!g_ghq_use)
{
g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs;
if (g_settings->ghq_use)
g_ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs() != CSettings::HiResPackFormat_None;
if (g_ghq_use)
{
/* Plugin path */
int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | texcmpr[g_settings->ghq_cmpr] | texhirs[g_settings->ghq_hirs];
if (g_settings->ghq_enht_cmpr)
int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | g_settings->ghq_hirs();
if (g_settings->ghq_enht_cmpr())
{
options |= COMPRESS_TEX;
}
if (g_settings->ghq_hirs_cmpr)
if (g_settings->ghq_hirs_cmpr())
{
options |= COMPRESS_HIRESTEX;
}
if (g_settings->ghq_hirs_tile)
if (g_settings->ghq_hirs_tile())
{
options |= TILE_HIRESTEX;
}
if (g_settings->ghq_enht_f16bpp)
if (g_settings->ghq_enht_f16bpp())
{
options |= FORCE16BPP_TEX;
}
if (g_settings->ghq_hirs_f16bpp)
if (g_settings->ghq_hirs_f16bpp())
{
options |= FORCE16BPP_HIRESTEX;
}
if (g_settings->ghq_enht_gz)
if (g_settings->ghq_enht_gz())
{
options |= GZ_TEXCACHE;
}
if (g_settings->ghq_hirs_gz)
if (g_settings->ghq_hirs_gz())
{
options |= GZ_HIRESTEXCACHE;
}
if (g_settings->ghq_cache_save)
if (g_settings->ghq_cache_save())
{
options |= (DUMP_TEXCACHE | DUMP_HIRESTEXCACHE);
}
if (g_settings->ghq_hirs_let_texartists_fly)
if (g_settings->ghq_hirs_let_texartists_fly())
{
options |= LET_TEXARTISTS_FLY;
}
if (g_settings->ghq_hirs_dump)
if (g_settings->ghq_hirs_dump())
{
options |= DUMP_TEX;
}
g_settings->ghq_use = (int)ext_ghq_init(voodoo.max_tex_size, // max texture width supported by hardware
g_ghq_use = (int)ext_ghq_init(voodoo.max_tex_size, // max texture width supported by hardware
voodoo.max_tex_size, // max texture height supported by hardware
voodoo.sup_32bit_tex ? 32 : 16, // max texture bpp supported by hardware
options,
g_settings->ghq_cache_size * 1024 * 1024, // cache texture to system memory
g_settings->texture_dir.c_str(),
g_settings->ghq_cache_size() * 1024 * 1024, // cache texture to system memory
g_settings->texture_dir(),
rdp.RomName, // name of ROM. must be no longer than 256 characters
DisplayLoadProgress);
}
}
if (g_settings->ghq_use && strstr(extensions, "TEXMIRROR"))
if (g_ghq_use && strstr(extensions, "TEXMIRROR"))
{
voodoo.sup_mirroring = 1;
}
@ -841,8 +837,8 @@ output: none
*******************************************************************/
EXPORT void CALL CaptureScreen(char * Directory)
{
capture_screen = 1;
capture_path = Directory;
g_capture_screen = true;
g_capture_path = Directory;
}
/******************************************************************
@ -897,10 +893,10 @@ void CALL CloseDLL(void)
{
WriteTrace(TraceGlide64, TraceDebug, "-");
if (g_settings->ghq_use)
if (g_ghq_use)
{
ext_ghq_shutdown();
g_settings->ghq_use = 0;
g_ghq_use = false;
}
if (g_settings)
@ -1008,7 +1004,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
CountCombine();
ZLUT_init();
grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic());
grGlideInit();
const char *extensions = grGetString(GR_EXTENSION);
grGlideShutdown();
@ -1150,10 +1146,10 @@ void CALL RomOpen(void)
name[strlen(name) - 1] = 0;
}
if (g_settings->ghq_use && strcmp(rdp.RomName, name) != 0)
if (g_ghq_use && strcmp(rdp.RomName, name) != 0)
{
ext_ghq_shutdown();
g_settings->ghq_use = 0;
g_ghq_use = false;
}
strcpy(rdp.RomName, name);
g_settings->ReadGameSettings(name);
@ -1176,15 +1172,6 @@ void CALL RomOpen(void)
if (evoodoo)
InitGfx();
if (strstr(extensions, "ROMNAME"))
{
char strSetRomName[] = "grSetRomName";
void (FX_CALL *grSetRomName)(char*);
grSetRomName = (void (FX_CALL *)(char*))grGetProcAddress(strSetRomName);
grSetRomName(name);
}
// **
}
/******************************************************************
@ -1205,9 +1192,8 @@ void CALL ShowCFB(void)
void drawViRegBG()
{
WriteTrace(TraceGlide64, TraceDebug, "start");
const uint32_t VIwidth = *gfx.VI_WIDTH_REG;
FB_TO_SCREEN_INFO fb_info;
fb_info.width = VIwidth;
fb_info.width = *gfx.VI_WIDTH_REG;
fb_info.height = (uint32_t)rdp.vi_height;
if (fb_info.height == 0)
{
@ -1216,7 +1202,7 @@ void drawViRegBG()
}
fb_info.ul_x = 0;
fb_info.lr_x = VIwidth - 1;
fb_info.lr_x = fb_info.width - 1;
// fb_info.lr_x = (uint32_t)rdp.vi_width - 1;
fb_info.ul_y = 0;
fb_info.lr_y = fb_info.height - 1;
@ -1452,9 +1438,9 @@ void newSwapBuffers()
grDepthMask(FXFALSE);
grCullMode(GR_CULL_DISABLE);
if (capture_screen)
if (g_capture_screen)
{
CPath path(capture_path);
CPath path(g_capture_path);
if (!path.DirectoryExists())
{
path.DirectoryCreate();
@ -1525,7 +1511,7 @@ void newSwapBuffers()
// Unlock the backbuffer
grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER);
write_png_file(path, image_width, image_height, ssimg);
capture_screen = 0;
g_capture_screen = false;
}
}
@ -1539,7 +1525,7 @@ void newSwapBuffers()
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
}
WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED");
grBufferSwap(g_settings->vsync);
grBufferSwap(g_settings->vsync());
if (*gfx.VI_STATUS_REG & 0x08) //gamma correction is used
{
if (!voodoo.gamma_correction)
@ -1562,7 +1548,7 @@ void newSwapBuffers()
}
}
if (g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX))
if (g_settings->wireframe() || g_settings->buff_clear() || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX))
{
grDepthMask((g_settings->hacks(CSettings::hack_RE2) && g_settings->fb_depth_render_enabled()) ? FXFALSE : FXTRUE);
grBufferClear(0, 0, 0xFFFF);

View File

@ -331,7 +331,7 @@ char ** grQueryResolutionsExt(int32_t * Size)
uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
g_FullScreenResolutions.getResolution(g_settings->wrpResolution, width, height);
return g_settings->wrpResolution;
g_FullScreenResolutions.getResolution(g_settings->FullScreenRes(), width, height);
return g_settings->FullScreenRes();
}
#endif

View File

@ -1,166 +1,144 @@
#include <Common/StdString.h>
#include <Settings/Settings.h>
#include "Gfx_1.3.h"
#include "ScreenResolution.h"
#include "SettingsID.h"
#ifdef _WIN32
int GetCurrentResIndex(void);
#endif
#ifdef ANDROID
extern uint32_t g_NativeWidth, g_NativeHeight;
#endif
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
extern int g_width, g_height;
CSettings::CSettings() :
m_Set_basic_mode(0),
m_Set_texture_dir(0),
m_Set_log_dir(0),
m_Set_log_flush(0),
m_dirty(false),
m_res_x(GetScreenResWidth(GetDefaultScreenRes())),
m_scr_res_x(GetScreenResWidth(GetDefaultScreenRes())),
m_res_y(GetScreenResHeight(GetDefaultScreenRes())),
m_scr_res_y(GetScreenResHeight(GetDefaultScreenRes())),
m_ScreenRes(GetDefaultScreenRes()),
advanced_options(0),
texenh_options(0),
vsync(0),
m_advanced_options(false),
m_texenh_options(false),
m_vsync(false),
m_rotate(Rotate_None),
m_filtering(Filter_Automatic),
fog(0),
buff_clear(0),
m_fog(false),
m_buff_clear(false),
m_swapmode(SwapMode_Old),
m_lodmode(LOD_Off),
m_aspectmode(Aspect_4x3),
m_frame_buffer(0),
m_fb_crc_mode(fbcrcFast),
//Texture filtering options
texture_dir(""),
//Texture filtering options
m_texture_dir(""),
m_ghq_fltr(TextureFilter_None),
m_ghq_enht(TextureEnht_None),
ghq_cmpr(0),
ghq_hirs(0),
ghq_use(0),
ghq_enht_cmpr(0),
ghq_enht_tile(0),
ghq_enht_f16bpp(0),
ghq_enht_gz(0),
ghq_enht_nobg(0),
ghq_hirs_cmpr(0),
ghq_hirs_tile(0),
ghq_hirs_f16bpp(0),
ghq_hirs_gz(0),
ghq_hirs_altcrc(0),
ghq_cache_save(0),
ghq_cache_size(0),
ghq_hirs_let_texartists_fly(0),
ghq_hirs_dump(0),
autodetect_ucode(0),
m_ghq_cmpr(TextureCompression_S3TC),
m_ghq_hirs(HiResPackFormat_None),
m_ghq_enht_cmpr(false),
m_ghq_enht_f16bpp(false),
m_ghq_enht_gz(false),
m_ghq_enht_nobg(false),
m_ghq_hirs_cmpr(false),
m_ghq_hirs_tile(false),
m_ghq_hirs_f16bpp(false),
m_ghq_hirs_gz(false),
m_ghq_hirs_altcrc(false),
m_ghq_cache_save(false),
m_ghq_cache_size(0),
m_ghq_hirs_let_texartists_fly(false),
m_ghq_hirs_dump(false),
m_autodetect_ucode(true),
m_ucode(ucode_Fast3D),
unk_as_red(0),
unk_clear(0),
wireframe(0),
wfmode(0),
m_unk_as_red(false),
m_wireframe(false),
m_wfmode(wfmode_VertexColors),
// Special fixes
offset_x(0),
offset_y(0),
scale_x(0),
scale_y(0),
fast_crc(0),
alt_tex_size(0),
use_sts1_only(0),
flame_corona(0), //hack for zeldas flame's corona
increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect
decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect
texture_correction(0), // enable perspective texture correction emulation. is on by default
// Special fixes
m_fast_crc(false),
m_alt_tex_size(false),
m_use_sts1_only(false),
m_flame_corona(false), //hack for zeldas flame's corona
m_increase_texrect_edge(false), // add 1 to lower right corner coordinates of texrect
m_decrease_fillrect_edge(false), // sub 1 from lower right corner coordinates of fillrect
m_texture_correction(false), // enable perspective texture correction emulation. is on by default
m_stipple_mode(STIPPLE_Disable), //used for dithered alpha emulation
stipple_pattern(0), //used for dithered alpha emulation
force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games
force_quad3d(0), //force 0xb5 command to be quad, not line 3d
clip_zmin(0), //enable near z clipping
clip_zmax(0), //enable far plane clipping;
adjust_aspect(0), //adjust screen aspect for wide screen mode
force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64
pal230(0), //set special scale for PAL games
correct_viewport(0), //correct viewport values
zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode
n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does.
m_stipple_pattern(0), //used for dithered alpha emulation
m_force_microcheck(false), //check microcode each frame, for mixed F3DEX-S2DEX games
m_force_quad3d(false), //force 0xb5 command to be quad, not line 3d
m_clip_zmin(false), //enable near z clipping
m_clip_zmax(false), //enable far plane clipping;
m_adjust_aspect(false), //adjust screen aspect for wide screen mode
m_force_calc_sphere(false), //use spheric mapping only, Ridge Racer 64
m_pal230(false), //set special scale for PAL games
m_correct_viewport(false), //correct viewport values
m_zmode_compare_less(false), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
m_old_style_adither(false), //apply alpha dither regardless of alpha_dither_mode
m_n64_z_scale(false), //scale vertex z value before writing to depth buffer, as N64 does.
m_hacks((hacks_t)0),
//wrapper settings
#ifndef ANDROID
wrpResolution(0),
m_FullScreenRes(0),
#endif
wrpVRAM(0),
wrpFBO(0),
wrpAnisotropic(0),
m_FlushLogs(false)
m_wrpVRAM(0),
m_wrpFBO(false),
m_wrpAnisotropic(false),
m_FlushLogs(false)
{
memset(m_log_dir, 0, sizeof(m_log_dir));
RegisterSettings();
ReadSettings();
}
CSettings::~CSettings()
{
}
void CSettings::RegisterSettings(void)
{
SetModuleName("default");
Set_basic_mode = FindSystemSettingId("Basic Mode");
Set_texture_dir = FindSystemSettingId("Dir:Texture");
Set_log_flush = FindSystemSettingId("Log Auto Flush");
Set_log_dir = FindSystemSettingId("Dir:Log");
m_Set_basic_mode = FindSystemSettingId("Basic Mode");
m_Set_texture_dir = FindSystemSettingId("Dir:Texture");
m_Set_log_flush = FindSystemSettingId("Log Auto Flush");
m_Set_log_dir = FindSystemSettingId("Dir:Log");
SetModuleName("Glide64");
general_setting(Set_Resolution, "resolution", GetDefaultScreenRes());
#ifdef _WIN32
general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex());
#endif
general_setting(Set_vsync, "vsync", 1);
general_setting(Set_texenh_options, "texenh_options", 0);
general_setting(Set_vsync, "vsync", true);
general_setting(Set_texenh_options, "texenh_options", false);
general_setting(Set_wrpVRAM, "wrpVRAM", 0);
#ifndef ANDROID
general_setting(Set_wrpFBO, "wrpFBO", 0);
general_setting(Set_wrpFBO, "wrpFBO", false);
#else
general_setting(Set_wrpFBO, "wrpFBO", 1);
general_setting(Set_wrpFBO, "wrpFBO", true);
#endif
general_setting(Set_Rotate, "rotate", Rotate_None);
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0);
general_setting(Set_autodetect_ucode, "autodetect_ucode", 1);
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", false);
general_setting(Set_autodetect_ucode, "autodetect_ucode", true);
general_setting(Set_ucode, "ucode", ucode_F3DEX2);
general_setting(Set_wireframe, "wireframe", 0);
general_setting(Set_wfmode, "wfmode", 1);
general_setting(Set_unk_as_red, "unk_as_red", 0);
general_setting(Set_unk_clear, "unk_clear", 0);
general_setting(Set_wireframe, "wireframe", false);
general_setting(Set_wfmode, "wfmode", wfmode_VertexColors);
general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None);
general_setting(Set_ghq_cmpr, "ghq_cmpr", 0);
general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC);
general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None);
general_setting(Set_ghq_hirs, "ghq_hirs", 0);
general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0);
general_setting(Set_ghq_enht_tile, "ghq_enht_tile", 0);
general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0);
general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1);
general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0);
general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0);
general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0);
general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0);
general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1);
general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", 1);
general_setting(Set_ghq_cache_save, "ghq_cache_save", 1);
general_setting(Set_ghq_hirs, "ghq_hirs", HiResPackFormat_None);
general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", false);
general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", false);
general_setting(Set_ghq_enht_gz, "ghq_enht_gz", true);
general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", false);
general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", false);
general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", false);
general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", false);
general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", true);
general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", true);
general_setting(Set_ghq_cache_save, "ghq_cache_save", true);
general_setting(Set_ghq_cache_size, "ghq_cache_size", 0);
general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0);
general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0);
general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", false);
general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", false);
general_setting(Set_optimize_texrect_default, "optimize_texrect", true);
general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic);
general_setting(Set_lodmode_default, "lodmode", CSettings::LOD_Off);
general_setting(Set_fog_default, "fog", 1);
general_setting(Set_buff_clear_default, "buff_clear", 1);
general_setting(Set_fog_default, "fog", true);
general_setting(Set_buff_clear_default, "buff_clear", true);
general_setting(Set_swapmode_default, "swapmode", SwapMode_New);
general_setting(Set_aspect_default, "aspect", Aspect_4x3);
@ -172,26 +150,30 @@ void CSettings::RegisterSettings(void)
general_setting(Set_fb_get_info_default, "fb_get_info", false);
general_setting(Set_fb_render_default, "fb_render", false);
game_setting(Set_alt_tex_size, "alt_tex_size", 0);
game_setting(Set_use_sts1_only, "use_sts1_only", 0);
game_setting(Set_force_calc_sphere, "force_calc_sphere", 0);
game_setting(Set_correct_viewport, "correct_viewport", 0);
game_setting(Set_increase_texrect_edge, "increase_texrect_edge", 0);
game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", 0);
game_setting(Set_texture_correction, "texture_correction", 1);
game_setting(Set_pal230, "pal230", 0);
#ifndef ANDROID
general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex());
#endif
game_setting(Set_alt_tex_size, "alt_tex_size", false);
game_setting(Set_use_sts1_only, "use_sts1_only", false);
game_setting(Set_force_calc_sphere, "force_calc_sphere", false);
game_setting(Set_correct_viewport, "correct_viewport", false);
game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false);
game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", false);
game_setting(Set_texture_correction, "texture_correction", true);
game_setting(Set_pal230, "pal230", false);
game_setting(Set_stipple_mode, "stipple_mode", STIPPLE_Rotate);
game_setting(Set_stipple_pattern, "stipple_pattern", 0x3E0F83E0);
game_setting(Set_force_microcheck, "force_microcheck", 0);
game_setting(Set_force_quad3d, "force_quad3d", 0);
game_setting(Set_clip_zmin, "clip_zmin", 0);
game_setting(Set_clip_zmax, "clip_zmax", 1);
game_setting(Set_fast_crc, "fast_crc", 1);
game_setting(Set_adjust_aspect, "adjust_aspect", 1);
game_setting(Set_zmode_compare_less, "zmode_compare_less", 0);
game_setting(Set_old_style_adither, "old_style_adither", 0);
game_setting(Set_n64_z_scale, "n64_z_scale", 0);
game_setting(Set_force_microcheck, "force_microcheck", false);
game_setting(Set_force_quad3d, "force_quad3d", false);
game_setting(Set_clip_zmin, "clip_zmin", false);
game_setting(Set_clip_zmax, "clip_zmax", true);
game_setting(Set_fast_crc, "fast_crc", true);
game_setting(Set_adjust_aspect, "adjust_aspect", true);
game_setting(Set_zmode_compare_less, "zmode_compare_less", false);
game_setting(Set_old_style_adither, "old_style_adither", false);
game_setting(Set_n64_z_scale, "n64_z_scale", false);
game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default);
game_setting(Set_ignore_aux_copy, "ignore_aux_copy", false);
game_setting(Set_hires_buf_clear, "hires_buf_clear", true);
@ -217,6 +199,15 @@ void CSettings::RegisterSettings(void)
}
void CSettings::SetTexenhOptions(bool value)
{
if (value != m_texenh_options)
{
m_texenh_options = value;
m_dirty = true;
}
}
void CSettings::SetScreenRes(uint32_t value)
{
if (value >= GetScreenResolutionCount())
@ -236,22 +227,19 @@ void CSettings::UpdateScreenSize(bool fullscreen)
#ifndef ANDROID
if (fullscreen)
{
g_width = GetFullScreenResWidth(wrpResolution);
g_height = GetFullScreenResHeight(wrpResolution);
g_width = GetFullScreenResWidth(m_FullScreenRes);
g_height = GetFullScreenResHeight(m_FullScreenRes);
}
else
{
#endif
g_width = GetScreenResWidth(m_ScreenRes);
g_height = GetScreenResHeight(m_ScreenRes);
#ifndef ANDROID
}
m_scr_res_x = m_res_x = g_width;
m_scr_res_y = m_res_y = g_height;
#else
g_width = GetScreenResWidth(m_ScreenRes);
g_height = GetScreenResHeight(m_ScreenRes);
m_scr_res_x = m_res_x = g_width;
m_scr_res_y = m_res_y = g_height;
#endif
m_scr_res_x = m_res_x = g_width;
m_scr_res_y = m_res_y = g_height;
UpdateAspectRatio();
}
@ -274,6 +262,15 @@ void CSettings::SetLODmode(PixelLevelOfDetail_t value)
}
}
void CSettings::SetVsync(bool value)
{
if (value != m_vsync)
{
m_vsync = value;
m_dirty = true;
}
}
void CSettings::SetFiltering(Filtering_t value)
{
if (value != m_filtering)
@ -292,6 +289,51 @@ void CSettings::SetSwapMode(SwapMode_t value)
}
}
void CSettings::SetFog(bool value)
{
if (value != m_fog)
{
m_fog = value;
m_dirty = true;
}
}
void CSettings::SetBuffClear(bool value)
{
if (value != m_buff_clear)
{
m_buff_clear = value;
m_dirty = true;
}
}
void CSettings::SetWrpAnisotropic(bool value)
{
if (value != m_wrpAnisotropic)
{
m_wrpAnisotropic = value;
m_dirty = true;
}
}
void CSettings::SetWrpVRAM(int value)
{
if (value != m_wrpVRAM)
{
m_wrpVRAM = value;
m_dirty = true;
}
}
void CSettings::SetWrpFBO(bool value)
{
if (value != m_wrpFBO)
{
m_wrpFBO = value;
m_dirty = true;
}
}
void CSettings::SetGhqFltr(TextureFilter_t value)
{
if (value != m_ghq_fltr)
@ -310,6 +352,132 @@ void CSettings::SetGhqEnht(TextureEnhancement_t value)
}
}
void CSettings::SetGhqCmpr(TextureCompression_t value)
{
if (value != m_ghq_cmpr)
{
m_ghq_cmpr = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirs(HiResPackFormat_t value)
{
if (value != m_ghq_hirs)
{
m_ghq_hirs = value;
m_dirty = true;
}
}
void CSettings::SetGhqEnhtGz(bool value)
{
if (value != m_ghq_enht_gz)
{
m_ghq_enht_gz = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsTile(bool value)
{
if (value != m_ghq_hirs_tile)
{
m_ghq_hirs_tile = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsF16bpp(bool value)
{
if (value != m_ghq_hirs_f16bpp)
{
m_ghq_hirs_f16bpp = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsDump(bool value)
{
if (value != m_ghq_hirs_dump)
{
m_ghq_hirs_dump = value;
m_dirty = true;
}
}
void CSettings::SetGhqEnhtNobg(bool value)
{
if (value != m_ghq_enht_nobg)
{
m_ghq_enht_nobg = value;
m_dirty = true;
}
}
void CSettings::SetGhqEnhtCmpr(bool value)
{
if (value != m_ghq_enht_cmpr)
{
m_ghq_enht_cmpr = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsAltcrc(bool value)
{
if (value != m_ghq_hirs_altcrc)
{
m_ghq_hirs_altcrc = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsCmpr(bool value)
{
if (value != m_ghq_hirs_cmpr)
{
m_ghq_hirs_cmpr = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsGz(bool value)
{
if (value != m_ghq_hirs_gz)
{
m_ghq_hirs_gz = value;
m_dirty = true;
}
}
void CSettings::SetGhqHirsLetTexartistsFly(bool value)
{
if (value != m_ghq_hirs_let_texartists_fly)
{
m_ghq_hirs_let_texartists_fly = value;
m_dirty = true;
}
}
void CSettings::SetGhqCacheSave(bool value)
{
if (value != m_ghq_cache_save)
{
m_ghq_cache_save = value;
m_dirty = true;
}
}
void CSettings::SetGhqCacheSize(int value)
{
if (value != m_ghq_cache_size)
{
m_ghq_cache_size = value;
m_dirty = true;
}
}
void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove)
{
uint32_t frame_buffer_original = m_frame_buffer;
@ -341,6 +509,17 @@ void CSettings::SetUcode(ucode_t value)
m_ucode = value;
}
#ifndef ANDROID
void CSettings::SetFullScreenRes(uint32_t value)
{
if (value != m_FullScreenRes)
{
m_FullScreenRes = value;
m_dirty = true;
}
}
#endif
void CSettings::UpdateAspectRatio(void)
{
switch (m_aspectmode)
@ -382,60 +561,49 @@ void CSettings::ReadSettings()
{
SetScreenRes(GetSetting(Set_Resolution));
#ifndef ANDROID
this->wrpResolution = GetSetting(Set_FullScreenRes);
SetFullScreenRes(GetSetting(Set_FullScreenRes));
#endif
this->vsync = GetSetting(Set_vsync);
m_vsync = GetSetting(Set_vsync) != 0;
m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate);
this->advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
this->texenh_options = GetSetting(Set_texenh_options);
m_advanced_options = m_Set_basic_mode ? GetSystemSetting(m_Set_basic_mode) == 0 : false;
m_texenh_options = GetSetting(Set_texenh_options) != 0;
this->wrpVRAM = GetSetting(Set_wrpVRAM);
this->wrpFBO = GetSetting(Set_wrpFBO);
this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic);
m_wrpVRAM = GetSetting(Set_wrpVRAM);
m_wrpFBO = GetSetting(Set_wrpFBO) != 0;
m_wrpAnisotropic = GetSetting(Set_wrpAnisotropic) != 0;
#ifndef _ENDUSER_RELEASE_
this->autodetect_ucode = GetSetting(Set_autodetect_ucode);
this->wireframe = GetSetting(Set_wireframe);
this->wfmode = GetSetting(Set_wfmode);
this->unk_as_red = GetSetting(Set_unk_as_red);
this->unk_clear = GetSetting(Set_unk_clear);
#else
this->autodetect_ucode = TRUE;
this->wireframe = FALSE;
this->wfmode = 0;
this->unk_as_red = FALSE;
this->unk_clear = FALSE;
#endif
m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0;
m_wireframe = GetSetting(Set_wireframe) != 0;
m_wfmode = (wfmode_t)GetSetting(Set_wfmode);
m_ucode = ucode_F3DEX2;
char texture_dir[260];
memset(texture_dir, 0, sizeof(texture_dir));
GetSystemSettingSz(Set_texture_dir, texture_dir, sizeof(texture_dir));
this->texture_dir = texture_dir;
GetSystemSettingSz(m_Set_texture_dir, texture_dir, sizeof(texture_dir));
m_texture_dir = texture_dir;
m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr);
this->ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr);
m_ghq_cmpr = (TextureCompression_t)GetSetting(Set_ghq_cmpr);
m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht);
this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs);
this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr);
this->ghq_enht_tile = GetSetting(Set_ghq_enht_tile);
this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp);
this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz);
this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg);
this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr);
this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile);
this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp);
this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz);
this->ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc);
this->ghq_cache_save = GetSetting(Set_ghq_cache_save);
this->ghq_cache_size = GetSetting(Set_ghq_cache_size);
this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly);
this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump);
m_ghq_hirs = (HiResPackFormat_t)GetSetting(Set_ghq_hirs);
m_ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr) != 0;
m_ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp) !=0;
m_ghq_enht_gz = GetSetting(Set_ghq_enht_gz) != 0;
m_ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg) != 0;
m_ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr) != 0;
m_ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile) != 0;
m_ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp) != 0;
m_ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz) != 0;
m_ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc) != 0;
m_ghq_cache_save = GetSetting(Set_ghq_cache_save) != 0;
m_ghq_cache_size = GetSetting(Set_ghq_cache_size);
m_ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly) != 0;
m_ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump) != 0;
if (Set_log_dir != 0)
if (m_Set_log_dir != 0)
{
GetSystemSettingSz(Set_log_dir, m_log_dir, sizeof(m_log_dir));
GetSystemSettingSz(m_Set_log_dir, m_log_dir, sizeof(m_log_dir));
}
m_FlushLogs = Set_log_flush != 0 ? GetSystemSetting(Set_log_flush) != 0 : false;
m_FlushLogs = m_Set_log_flush != 0 ? GetSystemSetting(m_Set_log_flush) != 0 : false;
m_dirty = false;
}
@ -573,29 +741,27 @@ void CSettings::ReadGameSettings(const char * name)
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Winback);
}
g_settings->alt_tex_size = GetSetting(Set_alt_tex_size);
g_settings->use_sts1_only = GetSetting(Set_use_sts1_only);
g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere);
g_settings->correct_viewport = GetSetting(Set_correct_viewport);
g_settings->increase_texrect_edge = GetSetting(Set_increase_texrect_edge);
g_settings->decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge);
g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1;
g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0;
m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0;
m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0;
m_force_calc_sphere = GetSetting(Set_force_calc_sphere) != 0;
m_correct_viewport = GetSetting(Set_correct_viewport);
m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0;
m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0;
m_texture_correction = GetSetting(Set_texture_correction) != 0;
m_pal230 = GetSetting(Set_pal230) != 0;
m_stipple_mode = (StippleMode_t)GetSetting(Set_stipple_mode);
int stipple_pattern = GetSetting(Set_stipple_pattern);
g_settings->stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0;
g_settings->force_microcheck = GetSetting(Set_force_microcheck);
g_settings->force_quad3d = GetSetting(Set_force_quad3d);
g_settings->clip_zmin = GetSetting(Set_clip_zmin);
g_settings->clip_zmax = GetSetting(Set_clip_zmax);
g_settings->fast_crc = GetSetting(Set_fast_crc);
g_settings->adjust_aspect = GetSetting(Set_adjust_aspect);
g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less);
g_settings->old_style_adither = GetSetting(Set_old_style_adither);
g_settings->n64_z_scale = GetSetting(Set_n64_z_scale);
m_stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0;
m_force_microcheck = GetSetting(Set_force_microcheck) != 0;
m_force_quad3d = GetSetting(Set_force_quad3d) != 0;
m_clip_zmin = GetSetting(Set_clip_zmin) != 0;
m_clip_zmax = GetSetting(Set_clip_zmax) != 0;
m_fast_crc = GetSetting(Set_fast_crc) != 0;
m_adjust_aspect = GetSetting(Set_adjust_aspect);
m_zmode_compare_less = GetSetting(Set_zmode_compare_less);
m_old_style_adither = GetSetting(Set_old_style_adither);
m_n64_z_scale = GetSetting(Set_n64_z_scale) != 0;
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
m_ScreenRes = GetSetting(Set_Resolution);
if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); }
@ -649,76 +815,73 @@ void CSettings::ReadGameSettings(const char * name)
else if (read_back_to_screen == 2) { fb_add_bits |= fb_read_back_to_screen2; }
else if (read_back_to_screen == 0) { fb_remove_bits |= fb_read_back_to_screen | fb_read_back_to_screen2; }
g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
m_fb_crc_mode = (FBCRCMODE_t)GetSetting(Set_fb_crc_mode);
SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default));
SetFog(GetSetting(g_romopen ? Set_fog : Set_fog_default) != 0);
SetBuffClear(GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default) != 0);
SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default));
SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default));
SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default));
g_settings->flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled();
m_flame_corona = hacks(hack_Zelda) && !fb_depth_render_enabled();
}
void CSettings::WriteSettings(void)
{
SetSetting(Set_Resolution, g_settings->m_ScreenRes);
#ifdef _WIN32
SetSetting(Set_FullScreenRes, g_settings->wrpResolution);
SetSetting(Set_Resolution, m_ScreenRes);
#ifndef ANDROID
SetSetting(Set_FullScreenRes, m_FullScreenRes);
#endif
SetSetting(Set_vsync, g_settings->vsync);
SetSetting(Set_vsync, m_vsync ? 1 : 0);
SetSetting(Set_Rotate, m_rotate);
SetSetting(Set_texenh_options, g_settings->texenh_options);
SetSetting(Set_texenh_options, m_texenh_options);
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
SetSetting(Set_wrpFBO, g_settings->wrpFBO);
SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic);
SetSetting(Set_wrpVRAM, m_wrpVRAM);
SetSetting(Set_wrpFBO, m_wrpFBO);
SetSetting(Set_wrpAnisotropic, m_wrpAnisotropic);
SetSetting(Set_autodetect_ucode, m_autodetect_ucode);
#ifndef _ENDUSER_RELEASE_
SetSetting(Set_autodetect_ucode, g_settings->autodetect_ucode);
SetSetting(Set_ucode, (int)g_settings->ucode);
SetSetting(Set_wireframe, g_settings->wireframe);
SetSetting(Set_wfmode, g_settings->wfmode);
SetSetting(Set_unk_as_red,g_settings->unk_as_red);
SetSetting(Set_unk_clear, g_settings->unk_clear);
#endif //_ENDUSER_RELEASE_
SetSetting(Set_wireframe, m_wireframe);
SetSetting(Set_wfmode, m_wfmode);
SetSetting(Set_ucode, (int)m_ucode);
SetSetting(Set_ghq_fltr, m_ghq_fltr);
SetSetting(Set_ghq_cmpr, g_settings->ghq_cmpr);
SetSetting(Set_ghq_cmpr, m_ghq_cmpr);
SetSetting(Set_ghq_enht, m_ghq_enht);
SetSetting(Set_ghq_hirs, g_settings->ghq_hirs);
SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr);
SetSetting(Set_ghq_enht_tile, g_settings->ghq_enht_tile);
SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp);
SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz);
SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg);
SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr);
SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile);
SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp);
SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz);
SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc);
SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save);
SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size);
SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly);
SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump);
SetSetting(Set_ghq_hirs, m_ghq_hirs);
SetSetting(Set_ghq_enht_cmpr, m_ghq_enht_cmpr);
SetSetting(Set_ghq_enht_f16bpp, m_ghq_enht_f16bpp);
SetSetting(Set_ghq_enht_gz, m_ghq_enht_gz);
SetSetting(Set_ghq_enht_nobg, m_ghq_enht_nobg);
SetSetting(Set_ghq_hirs_cmpr, m_ghq_hirs_cmpr);
SetSetting(Set_ghq_hirs_tile, m_ghq_hirs_tile);
SetSetting(Set_ghq_hirs_f16bpp, m_ghq_hirs_f16bpp);
SetSetting(Set_ghq_hirs_gz, m_ghq_hirs_gz);
SetSetting(Set_ghq_hirs_altcrc, m_ghq_hirs_altcrc);
SetSetting(Set_ghq_cache_save, m_ghq_cache_save);
SetSetting(Set_ghq_cache_size, m_ghq_cache_size);
SetSetting(Set_ghq_hirs_let_texartists_fly, m_ghq_hirs_let_texartists_fly);
SetSetting(Set_ghq_hirs_dump, m_ghq_hirs_dump);
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering());
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode());
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, lodmode());
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, m_filtering);
SetSetting(g_romopen ? Set_fog : Set_fog_default, m_fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, m_buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, m_swapmode);
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, m_lodmode);
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, m_aspectmode);
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->fb_ref_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->fb_emulation_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->fb_hwfbe_set() ? true : false);
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->fb_get_info_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->fb_depth_render_enabled() ? true : false);
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->fb_cpu_write_hack_enabled() ? true : false);
if (g_settings->fb_read_back_to_screen_enabled())
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, fb_ref_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, fb_emulation_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, fb_hwfbe_set() ? true : false);
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, fb_get_info_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, fb_depth_render_enabled() ? true : false);
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, fb_cpu_write_hack_enabled() ? true : false);
if (fb_read_back_to_screen_enabled())
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1);
}
else if (g_settings->fb_read_back_to_screen2_enabled())
else if (fb_read_back_to_screen2_enabled())
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2);
}
@ -730,7 +893,29 @@ void CSettings::WriteSettings(void)
FlushSettings();
}
void CSettings::general_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_General, name, NULL, value, NULL);
}
void CSettings::game_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL);
}
void CSettings::game_setting_default(short setting_ID, const char * name, short default_setting)
{
RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting);
}
void CSettings::SettingsChanged(void)
{
m_ScreenRes = GetSetting(Set_Resolution);
}
void UseUnregisteredSetting(int /*SettingID*/)
{
#ifdef _WIN32
DebugBreak();
#endif
}

View File

@ -5,7 +5,6 @@ class CSettings
{
public:
CSettings();
~CSettings();
//Frame buffer emulation options
enum fb_bits_t
@ -107,6 +106,18 @@ public:
TextureEnht_HQ4X = 0x500,
};
enum TextureCompression_t
{
TextureCompression_S3TC = 0x3000,
TextureCompression_FXT1 = 0x1000,
};
enum HiResPackFormat_t
{
HiResPackFormat_None = 0,
HiResPackFormat_Riceformat = 0x00020000,
};
enum SwapMode_t
{
SwapMode_Old = 0,
@ -145,15 +156,12 @@ public:
ucode_Turbo3d = 21,
};
int advanced_options;
int texenh_options;
int vsync;
int fog;
int buff_clear;
enum wfmode_t
{
wfmode_NormalColors = 0,
wfmode_VertexColors = 1,
wfmode_RedOnly = 2,
};
enum FBCRCMODE_t
{
@ -184,10 +192,14 @@ public:
inline uint32_t scr_res_x(void) const { return m_scr_res_x; }
inline uint32_t scr_res_y(void) const { return m_scr_res_y; }
inline uint32_t ScreenRes(void) const { return m_ScreenRes; }
inline bool FlushLogs(void) const { return m_FlushLogs; }
inline bool advanced_options(void) const { return m_advanced_options; }
inline bool texenh_options(void) const { return m_texenh_options; }
inline bool vsync(void) const { return m_vsync; }
inline ScreenRotate_t rotate(void) const { return m_rotate; }
inline Filtering_t filtering(void) const { return m_filtering; }
inline bool fog (void) const { return m_fog; }
inline bool buff_clear(void) const { return m_buff_clear; }
inline SwapMode_t swapmode(void) const { return m_swapmode; }
inline PixelLevelOfDetail_t lodmode(void) const { return m_lodmode; }
inline AspectMode_t aspectmode(void) const { return m_aspectmode; }
@ -195,87 +207,111 @@ public:
inline FBCRCMODE_t fb_crc_mode(void) const { return m_fb_crc_mode; }
//Texture filtering options
std::string texture_dir;
inline const char * texture_dir(void) const { return m_texture_dir.c_str(); }
inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; }
inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; }
int ghq_cmpr;
int ghq_hirs;
int ghq_use;
int ghq_enht_cmpr;
int ghq_enht_tile;
int ghq_enht_f16bpp;
int ghq_enht_gz;
int ghq_enht_nobg;
int ghq_hirs_cmpr;
int ghq_hirs_tile;
int ghq_hirs_f16bpp;
int ghq_hirs_gz;
int ghq_hirs_altcrc;
int ghq_cache_save;
int ghq_cache_size;
int ghq_hirs_let_texartists_fly;
int ghq_hirs_dump;
inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; }
inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; }
inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; }
inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; }
inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; }
inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; }
inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; }
inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; }
inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; }
inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; }
inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; }
inline bool ghq_cache_save(void) const { return m_ghq_cache_save; }
inline int ghq_cache_size(void) const { return m_ghq_cache_size; }
inline bool ghq_hirs_let_texartists_fly(void) const { return m_ghq_hirs_let_texartists_fly; }
inline bool ghq_hirs_dump(void) const { return m_ghq_hirs_dump; }
//Debug
int autodetect_ucode;
inline bool autodetect_ucode(void) const { return m_autodetect_ucode; }
inline ucode_t ucode(void) const { return m_ucode; }
int unk_as_red;
int unk_clear;
int wireframe;
int wfmode;
inline bool unk_as_red(void) const { return m_unk_as_red; }
inline bool wireframe(void) const { return m_wireframe; }
inline wfmode_t wfmode(void) const { return m_wfmode; }
// Special fixes
int offset_x, offset_y;
int scale_x, scale_y;
int fast_crc;
int alt_tex_size;
int use_sts1_only;
int flame_corona; //hack for zeldas flame's corona
int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect
int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect
int texture_correction; // enable perspective texture correction emulation. is on by default
inline bool fast_crc(void) const { return m_fast_crc; }
inline bool alt_tex_size(void) const { return m_alt_tex_size; }
inline bool use_sts1_only(void) const { return m_use_sts1_only; }
inline bool flame_corona(void) const { return m_flame_corona; } //hack for zeldas flame's corona
inline bool increase_texrect_edge(void) const { return m_increase_texrect_edge; } // add 1 to lower right corner coordinates of texrect
inline bool decrease_fillrect_edge(void) const { return m_decrease_fillrect_edge; }; // sub 1 from lower right corner coordinates of fillrect
inline bool texture_correction(void) const { return m_texture_correction; } // enable perspective texture correction emulation. is on by default
inline StippleMode_t stipple_mode(void) const { return m_stipple_mode; } //used for dithered alpha emulation
uint32_t stipple_pattern; //used for dithered alpha emulation
int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games
int force_quad3d; //force 0xb5 command to be quad, not line 3d
int clip_zmin; //enable near z clipping
int clip_zmax; //enable far plane clipping;
int adjust_aspect; //adjust screen aspect for wide screen mode
int force_calc_sphere; //use spheric mapping only, Ridge Racer 64
int pal230; //set special scale for PAL games
int correct_viewport; //correct viewport values
int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
int old_style_adither; //apply alpha dither regardless of alpha_dither_mode
int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does.
inline uint32_t stipple_pattern(void) const { return m_stipple_pattern; } //used for dithered alpha emulation
inline bool force_microcheck(void) const { return m_force_microcheck; } //check microcode each frame, for mixed F3DEX-S2DEX games
inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d
inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping
inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping
inline bool adjust_aspect(void) const { return m_adjust_aspect; } //adjust screen aspect for wide screen mode
inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64
inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64
inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values
inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
inline bool old_style_adither(void) const { return m_old_style_adither; } //apply alpha dither regardless of alpha_dither_mode
inline bool n64_z_scale(void) const { return m_n64_z_scale; } //scale vertex z value before writing to depth buffer, as N64 does.
inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks
//wrapper settings
#ifndef ANDROID
int wrpResolution;
inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; }
#endif
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
inline int wrpVRAM(void) const { return m_wrpVRAM; }
inline bool wrpFBO(void) const { return m_wrpFBO; }
inline bool wrpAnisotropic(void) const { return m_wrpAnisotropic; }
inline bool FlushLogs(void) const { return m_FlushLogs; }
void SetTexenhOptions(bool value);
void SetScreenRes(uint32_t value);
void SetAspectmode(AspectMode_t value);
void SetLODmode(PixelLevelOfDetail_t value);
void SetVsync(bool value);
void SetFiltering(Filtering_t value);
void SetSwapMode(SwapMode_t value);
void SetFog(bool value);
void SetBuffClear(bool value);
void SetWrpAnisotropic(bool value);
void SetWrpVRAM(int value);
void SetWrpFBO(bool value);
void SetGhqFltr(TextureFilter_t value);
void SetGhqEnht(TextureEnhancement_t value);
void SetGhqCmpr(TextureCompression_t value);
void SetGhqHirs(HiResPackFormat_t value);
void SetGhqEnhtGz(bool value);
void SetGhqHirsTile(bool value);
void SetGhqHirsF16bpp(bool value);
void SetGhqHirsDump(bool value);
void SetGhqEnhtNobg(bool value);
void SetGhqEnhtCmpr(bool value);
void SetGhqHirsAltcrc(bool value);
void SetGhqHirsCmpr(bool value);
void SetGhqHirsGz(bool value);
void SetGhqCacheSave(bool value);
void SetGhqHirsLetTexartistsFly(bool value);
void SetGhqCacheSize(int value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
ucode_t DetectUCode(uint32_t uc_crc);
void SetUcode(ucode_t value);
#ifndef ANDROID
void SetFullScreenRes(uint32_t value);
#endif
void ReadSettings();
void ReadGameSettings(const char * name);
void WriteSettings(void);
void UpdateAspectRatio(void);
void UpdateScreenSize(bool fullscreen);
private:
void ReadSettings();
static void general_setting(short setting_ID, const char * name, unsigned int value);
static void game_setting(short setting_ID, const char * name, unsigned int value);
static void game_setting_default(short setting_ID, const char * name, short default_setting);
void RegisterSettings(void);
void UpdateAspectRatio(void);
void SettingsChanged(void);
static void stSettingsChanged(void * _this)
@ -283,7 +319,18 @@ private:
((CSettings *)_this)->SettingsChanged();
}
short m_Set_basic_mode;
short m_Set_texture_dir;
short m_Set_log_dir;
short m_Set_log_flush;
bool m_dirty;
#ifndef ANDROID
uint32_t m_FullScreenRes;
#endif
int m_wrpVRAM;
bool m_wrpFBO;
bool m_wrpAnisotropic;
bool m_FlushLogs;
char m_log_dir[260];
uint32_t m_ScreenRes;
@ -294,12 +341,56 @@ private:
FBCRCMODE_t m_fb_crc_mode;
ScreenRotate_t m_rotate;
Filtering_t m_filtering;
bool m_fog;
bool m_buff_clear;
SwapMode_t m_swapmode;
PixelLevelOfDetail_t m_lodmode;
bool m_advanced_options;
bool m_texenh_options;
bool m_vsync;
std::string m_texture_dir;
TextureFilter_t m_ghq_fltr;
TextureEnhancement_t m_ghq_enht;
TextureCompression_t m_ghq_cmpr;
HiResPackFormat_t m_ghq_hirs;
bool m_ghq_enht_cmpr;
bool m_ghq_enht_f16bpp;
bool m_ghq_enht_gz;
bool m_ghq_enht_nobg;
bool m_ghq_hirs_cmpr;
bool m_ghq_hirs_tile;
bool m_ghq_hirs_f16bpp;
bool m_ghq_hirs_gz;
bool m_ghq_hirs_altcrc;
bool m_ghq_cache_save;
int m_ghq_cache_size;
bool m_ghq_hirs_let_texartists_fly;
bool m_ghq_hirs_dump;
bool m_autodetect_ucode;
bool m_unk_as_red;
bool m_wireframe;
wfmode_t m_wfmode;
ucode_t m_ucode;
bool m_fast_crc;
bool m_alt_tex_size;
bool m_use_sts1_only;
bool m_flame_corona;
bool m_increase_texrect_edge;
bool m_decrease_fillrect_edge;
bool m_texture_correction;
StippleMode_t m_stipple_mode;
uint32_t m_stipple_pattern;
bool m_force_microcheck;
bool m_force_quad3d;
bool m_clip_zmin;
bool m_clip_zmax;
bool m_adjust_aspect;
bool m_force_calc_sphere;
bool m_pal230;
bool m_correct_viewport;
bool m_zmode_compare_less;
bool m_old_style_adither;
bool m_n64_z_scale;
hacks_t m_hacks;
};

View File

@ -15,8 +15,7 @@ enum
// General Settings
Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM,
Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe,
Set_wfmode, Set_unk_as_red, Set_unk_clear, Set_ghq_fltr,
Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_tile,
Set_wfmode, Set_ghq_fltr, Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr,
Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr,
Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc,
Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly,

View File

@ -461,7 +461,7 @@ int CloseTextureBuffer(int draw)
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -526,7 +526,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
WriteTrace(TraceRDP, TraceDebug, "CopyTextureBuffer draw, OK");
rdp.tbuff_tex = 0;
@ -580,7 +580,7 @@ int CopyDepthBuffer()
grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer draw, OK");
rdp.tbuff_tex = 0;
@ -654,7 +654,7 @@ int SwapTextureBuffer()
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}

View File

@ -60,6 +60,8 @@ uint8_t *texture_buffer = tex1;
#include "TexModCI.h"
#include "CRC.h"
extern bool g_ghq_use;
typedef struct TEXINFO_t
{
int real_image_width, real_image_height; // FOR ALIGNMENT PURPOSES ONLY!!!
@ -198,7 +200,7 @@ void GetTexInfo(int id, int tile)
mask_width = (rdp.tiles[tile].mask_s == 0) ? (tile_width) : (1 << rdp.tiles[tile].mask_s);
mask_height = (rdp.tiles[tile].mask_t == 0) ? (tile_height) : (1 << rdp.tiles[tile].mask_t);
if (g_settings->alt_tex_size)
if (g_settings->alt_tex_size())
{
// ** ALTERNATE TEXTURE SIZE METHOD **
// Helps speed in some games that loaded weird-sized textures, but could break other
@ -351,7 +353,7 @@ void GetTexInfo(int id, int tile)
if (rdp.tiles[tile].size == 3)
line <<= 1;
uint32_t crc = 0;
if (g_settings->fast_crc)
if (g_settings->fast_crc())
{
line = (line - wid_64) << 3;
if (wid_64 < 1) wid_64 = 1;
@ -1255,7 +1257,7 @@ void LoadTex(int id, int tmu)
GHQTexInfo ghqTexInfo;
memset(&ghqTexInfo, 0, sizeof(GHQTexInfo));
uint32_t g64_crc = cache->crc;
if (g_settings->ghq_use)
if (g_ghq_use)
{
int bpl;
uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[td].t_mem]);
@ -1297,7 +1299,7 @@ void LoadTex(int id, int tmu)
{
if (rdp.tiles[td].size == 1)
paladdr = (uint8_t*)(rdp.pal_8_rice);
else if (g_settings->ghq_hirs_altcrc)
else if (g_settings->ghq_hirs_altcrc())
paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 5));
else
paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 4));
@ -1579,10 +1581,10 @@ void LoadTex(int id, int tmu)
if (GfxInitDone)
{
if (g_settings->ghq_use)
if (g_ghq_use)
{
if (!ghqTexInfo.data)
if (!g_settings->ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
if (!g_settings->ghq_enht_nobg() || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);
if (ghqTexInfo.data)

View File

@ -802,11 +802,11 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th
rdp.clip = 0;
else
{
if (!g_settings->clip_zmin)
if (!g_settings->clip_zmin())
{
rdp.clip &= ~CLIP_ZMIN;
}
if (!g_settings->clip_zmax)
if (!g_settings->clip_zmax())
{
rdp.clip &= ~CLIP_ZMAX;
}
@ -1025,7 +1025,7 @@ static void CalculateLOD(VERTEX *v, int n)
float ScaleZ(float z)
{
if (g_settings->n64_z_scale)
if (g_settings->n64_z_scale())
{
int iz = (int)(z*8.0f + 0.5f);
if (iz < 0) iz = 0;
@ -1576,7 +1576,7 @@ static void render_tri(uint16_t linew, int old_interpolate)
cmb.cmb_ext_use = cmb.tex_cmb_ext_use = 0;
if (g_settings->wireframe)
if (g_settings->wireframe())
{
SetWireframeCol();
for (i = 0; i < n; i++)
@ -1792,11 +1792,11 @@ void update()
switch ((rdp.rm & 0xC00) >> 10) {
case 0:
grDepthBiasLevel(0);
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
grDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL);
break;
case 1:
grDepthBiasLevel(-4);
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
grDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL);
break;
case 2:
grDepthBiasLevel(g_settings->ucode() == CSettings::ucode_PerfectDark ? -4 : 0);
@ -1876,23 +1876,20 @@ void update()
}
if (rdp.acmp == 3 && rdp.cycle_mode < 2)
{
if (grStippleModeExt != 0)
if (g_settings->old_style_adither() || rdp.alpha_dither_mode != 3)
{
if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) {
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither");
grStippleModeExt(g_settings->stipple_mode());
}
else
grStippleModeExt(GR_STIPPLE_DISABLE);
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither");
grStippleMode(g_settings->stipple_mode());
}
else
{
grStippleMode(GR_STIPPLE_DISABLE);
}
}
else
{
if (grStippleModeExt)
{
//WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled");
grStippleModeExt(GR_STIPPLE_DISABLE);
}
//WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled");
grStippleMode(GR_STIPPLE_DISABLE);
}
}
// Cull mode (leave this in for z-clipped triangles)
@ -1919,7 +1916,7 @@ void update()
}
//Added by Gonetz.
if (g_settings->fog && (rdp.update & UPDATE_FOG_ENABLED))
if (g_settings->fog() && (rdp.update & UPDATE_FOG_ENABLED))
{
rdp.update ^= UPDATE_FOG_ENABLED;
@ -2010,10 +2007,7 @@ void set_message_combiner()
GR_BLEND_ZERO,
GR_BLEND_ZERO);
grAlphaTestFunction(GR_CMP_ALWAYS);
if (grStippleModeExt)
{
grStippleModeExt(GR_STIPPLE_DISABLE);
}
grStippleMode(GR_STIPPLE_DISABLE);
grTexFilterMode(0, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR);
grTexCombine(GR_TMU1,
GR_COMBINE_FUNCTION_NONE,

View File

@ -350,7 +350,7 @@ void microcheck()
rdp.Persp_en = 1;
rdp.persp_supported = FALSE;
}
else if (g_settings->texture_correction)
else if (g_settings->texture_correction())
{
rdp.persp_supported = TRUE;
}
@ -576,7 +576,7 @@ EXPORT void CALL ProcessDList(void)
if (reset)
{
reset = 0;
if (g_settings->autodetect_ucode)
if (g_settings->autodetect_ucode())
{
// Thanks to ZeZu for ucode autodetection!!!
uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0);
@ -586,7 +586,7 @@ EXPORT void CALL ProcessDList(void)
else
memset(microcode, 0, 4096);
}
else if ((g_old_ucode == CSettings::ucode_S2DEX && g_settings->ucode() == CSettings::ucode_F3DEX) || g_settings->force_microcheck)
else if ((g_old_ucode == CSettings::ucode_S2DEX && g_settings->ucode() == CSettings::ucode_F3DEX) || g_settings->force_microcheck())
{
uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0);
memcpy(microcode, gfx.RDRAM + startUcode, 4096);
@ -737,10 +737,10 @@ EXPORT void CALL ProcessDList(void)
{
ReleaseGfx ();
rdp_reset();
if (g_settings->ghq_use)
if (g_ghq_use)
{
ext_ghq_shutdown();
g_settings->ghq_use = 0;
g_ghq_use = false;
}
}
if (MessageBox(gfx.hWnd, "The GFX plugin caused an exception and has been disabled.\nWould you like to turn it back on and attempt to continue?","Glide64 Exception", MB_YESNO|MB_ICONEXCLAMATION) == MB_NO)
@ -965,11 +965,14 @@ static void rdp_texrect()
if ((rdp.othermode_l >> 16) == 0x3c18 && rdp.cycle1 == 0x03ffffff && rdp.cycle2 == 0x01ff1fff) //depth image based fog
{
if (!depth_buffer_fog)
return;
if (g_settings->fog)
DrawDepthBufferFog();
depth_buffer_fog = FALSE;
if (depth_buffer_fog)
{
if (g_settings->fog())
{
DrawDepthBufferFog();
}
depth_buffer_fog = false;
}
return;
}
@ -1005,7 +1008,7 @@ static void rdp_texrect()
else if (lr_y - ul_y < 1.0f)
lr_y = ceil(lr_y);
if (g_settings->increase_texrect_edge)
if (g_settings->increase_texrect_edge())
{
if (floor(lr_x) != lr_x)
lr_x = ceil(lr_x);
@ -1408,7 +1411,7 @@ static void rdp_texrect()
ConvertCoordsConvert(vptr, n_vertices);
if (g_settings->wireframe)
if (g_settings->wireframe())
{
SetWireframeCol();
grDrawLine(&vstd[0], &vstd[2]);
@ -1566,7 +1569,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count)
WriteTrace(TraceTLUT, TraceDebug, "%d: %08lx", i, *(uint16_t *)(gfx.RDRAM + (addr ^ 2)));
}
if (g_settings->ghq_hirs)
if (g_settings->ghq_hirs() != CSettings::HiResPackFormat_None)
{
memcpy((uint8_t*)(rdp.pal_8_rice + start), spal, count << 1);
}
@ -1640,7 +1643,7 @@ static void rdp_settilesize()
else if (wrong_tile == (int)tile)
wrong_tile = -1;
if (g_settings->use_sts1_only)
if (g_settings->use_sts1_only())
{
// ** USE FIRST SETTILESIZE ONLY **
// This option helps certain textures while using the 'Alternate texture size method',
@ -2281,7 +2284,7 @@ static void rdp_fillrect()
// Update scissor
update_scissor();
if (g_settings->decrease_fillrect_edge && rdp.cycle_mode == 0)
if (g_settings->decrease_fillrect_edge() && rdp.cycle_mode == 0)
{
lr_x--; lr_y--;
}
@ -2350,10 +2353,7 @@ static void rdp_fillrect()
grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO);
grAlphaTestFunction(GR_CMP_ALWAYS);
if (grStippleModeExt)
{
grStippleModeExt(GR_STIPPLE_DISABLE);
}
grStippleMode(GR_STIPPLE_DISABLE);
grCullMode(GR_CULL_DISABLE);
grFogMode(GR_FOG_DISABLE);
@ -2386,7 +2386,7 @@ static void rdp_fillrect()
}
}
if (g_settings->wireframe)
if (g_settings->wireframe())
{
SetWireframeCol();
grDrawLine(&v[0], &v[2]);
@ -2967,10 +2967,10 @@ static void rsp_reserved3()
void SetWireframeCol()
{
switch (g_settings->wfmode)
switch (g_settings->wfmode())
{
//case 0: // normal colors, don't do anything
case 1: // vertex colors
//case CSettings::wfmode_NormalColors: // normal colors, don't do anything
case CSettings::wfmode_VertexColors:
grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_ITERATED,
@ -2998,7 +2998,7 @@ void SetWireframeCol()
GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE);
break;
case 2: // red only
case CSettings::wfmode_RedOnly:
grColorCombine(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,

View File

@ -163,9 +163,6 @@ typedef struct {
uint32_t lr_x;
uint32_t lr_y;
} SCISSOR;
extern uint32_t texcmpr[];
extern uint32_t texhirs[];
typedef struct {
uint16_t tile_ul_s;

View File

@ -357,10 +357,10 @@ static void uc0_movemem()
short trans_x = ((short*)gfx.RDRAM)[(a + 4) ^ 1] / 4;
short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] / 4;
short trans_z = ((short*)gfx.RDRAM)[(a + 6) ^ 1];
if (g_settings->correct_viewport)
if (g_settings->correct_viewport())
{
scale_x = abs(scale_x);
scale_y = abs(scale_y);
scale_x = (short)abs(scale_x);
scale_y = (short)abs(scale_y);
}
rdp.view_scale[0] = scale_x * rdp.scale_x;
rdp.view_scale[1] = -scale_y * rdp.scale_y;
@ -922,7 +922,7 @@ static void uc0_setothermode_l()
rdp.update |= UPDATE_FOG_ENABLED; //if blender has no fog bits, fog must be set off
rdp.render_mode_changed |= rdp.rm ^ rdp.othermode_l;
rdp.rm = rdp.othermode_l;
if (g_settings->flame_corona && (rdp.rm == 0x00504341)) //hack for flame's corona
if (g_settings->flame_corona() && (rdp.rm == 0x00504341)) //hack for flame's corona
{
rdp.othermode_l |= 0x00000010;
}

View File

@ -104,7 +104,7 @@ static void uc1_tri2()
static void uc1_line3d()
{
if (!g_settings->force_quad3d && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
if (!g_settings->force_quad3d() && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
{
uint16_t width = (uint16_t)(rdp.cmd1 & 0xFF) + 3;

View File

@ -413,7 +413,7 @@ static void uc2_geom_mode()
{
if ((rdp.flags & ZBUF_ENABLED))
{
if (!g_settings->flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona
if (!g_settings->flame_corona() || (rdp.rm != 0x00504341)) //hack for flame's corona
{
rdp.flags ^= ZBUF_ENABLED;
}

View File

@ -231,7 +231,6 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
grSstOrigin(GR_ORIGIN_UPPER_LEFT);
grBufferClear(0, 0, 0xFFFF);
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
@ -287,7 +286,9 @@ void DrawImage(DRAWIMAGE & d)
{
if (d.imageW == 0 || d.imageH == 0 || d.frameH == 0) return;
int x_size, y_size, x_shift, y_shift, line;
int x_shift, y_shift;
uint16_t x_size, y_size, line;
// choose optimum size for the format/size
switch (d.imageSiz)
{
@ -950,7 +951,7 @@ static void uc6_draw_polygons(VERTEX v[4])
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -1659,7 +1660,7 @@ void uc6_sprite2d()
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}

View File

@ -146,8 +146,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
switch (_options & HIRESTEXTURES_MASK)
{
case GHQ_HIRESTEXTURES:
break;
case RICE_HIRESTEXTURES:
INFO(80, "-----\n");
INFO(80, "using Rice hires texture format...\n");
@ -163,8 +161,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
dir_path.AppendDirectory(_ident.c_str());
loadHiResTextures(dir_path, replace);
break;
case JABO_HIRESTEXTURES:
;
}
return 1;

View File

@ -1689,7 +1689,7 @@ grChromakeyValue(GrColor_t value)
g_chroma_color[2], g_chroma_color[3]);
}
static void setPattern()
void setPattern()
{
int i;
GLubyte stip[32 * 4];
@ -1724,15 +1724,6 @@ static void setPattern()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
FX_ENTRY void FX_CALL
grStipplePattern(
GrStipplePattern_t stipple)
{
WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple);
srand(stipple);
setPattern();
}
FX_ENTRY void FX_CALL
grStippleMode(GrStippleMode_t mode)
{

View File

@ -350,7 +350,7 @@ void FindBestDepthBias()
glVertex3f(float(x + 4 - widtho) / (width / 2), float(4 - heighto) / (height / 2), 0.5);
glVertex3f(float(x - widtho) / (width / 2), float(4 - heighto) / (height / 2), 0.5);
glEnd();
glReadPixels(x + 2, 2 + viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
glReadPixels(x + 2, 2 + g_viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
z -= 0.75f + 8e-6f;
if (z < 0.0f) z = -z;
if (z > 0.01f) continue;
@ -397,7 +397,7 @@ grDrawTriangle(const void *a, const void *b, const void *c)
vbo_enable();
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -436,7 +436,7 @@ grDrawPoint(const void *pt)
if(nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -506,7 +506,7 @@ grDrawLine(const void *a, const void *b)
if(nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -579,7 +579,7 @@ grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers2)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -603,7 +603,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 strid
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}

View File

@ -71,8 +71,8 @@ if (x+width >= screen_width) {
width = screen_width - x;
//printf("resizing w --> %d\n", width);
}
if (y+height >= screen_height+viewport_offset) {
height = screen_height+viewport_offset - y;
if (y+height >= screen_height+g_viewport_offset) {
height = screen_height+g_viewport_offset - y;
//printf("resizing h --> %d\n", height);
}
glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height);
@ -161,7 +161,7 @@ int default_texture; // the infamous "32*1024*1024" is now configurable
int current_texture;
int depth_texture, color_texture;
int glsl_support = 1;
int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0;
int viewport_width, viewport_height, g_viewport_offset = 0, nvidia_viewport_hack = 0;
int save_w, save_h;
int lfb_color_fmt;
float invtex[2];
@ -280,11 +280,11 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy)
if (int(miny) < 0) miny = 0;
if (maxx < minx) maxx = minx;
if (maxy < miny) maxy = miny;
glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny);
glScissor(minx, miny + g_viewport_offset, maxx - minx, maxy - miny);
//printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy);
}
else {
glScissor(minx, (viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
}
glEnable(GL_SCISSOR_TEST);
}
@ -395,13 +395,13 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrColorFormat_t color_format, GrOrigi
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "g_width: %d, g_height: %d fullscreen: %d", g_width, g_height, fullscreen);
//viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
// ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero
viewport_offset = 0; //-10 //-20;
//g_viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
// ZIGGY g_viewport_offset is WIN32 specific, with SDL just set it to zero
g_viewport_offset = 0; //-10 //-20;
printf("(II) Setting video mode %dx%d...\n", g_width, g_height);
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
lfb_color_fmt = color_format;
if (origin_location != GR_ORIGIN_UPPER_LEFT) WriteTrace(TraceGlitch, TraceWarning, "origin must be in upper left corner");
if (nColBuffers != 2) WriteTrace(TraceGlitch, TraceWarning, "number of color buffer is not 2");
@ -529,12 +529,12 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrColorFormat_t color_format, GrOrigi
#endif
#ifdef _WIN32
glViewport(0, viewport_offset, width, height);
glViewport(0, g_viewport_offset, width, height);
viewport_width = width;
viewport_height = height;
nvidia_viewport_hack = 1;
#else
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
viewport_width = g_width;
viewport_height = g_height;
#endif // _WIN32
@ -725,26 +725,26 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
if (save_w) {
if (tw > save_w && th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, tw, th - save_h);
0, g_viewport_offset + save_h, tw, th - save_h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
save_h = th;
}
else if (tw > save_w) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
}
else if (th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, save_w, th - save_h);
0, g_viewport_offset + save_h, save_w, th - save_h);
save_h = th;
}
}
else {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
0, viewport_offset, tw, th);
0, g_viewport_offset, tw, th);
save_w = tw;
save_h = th;
}
@ -793,12 +793,12 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
//printf("viewport %dx%d\n", width, height);
if (g_height > screen_height) {
glViewport(0, viewport_offset + screen_height - g_height, g_width, g_height);
glViewport(0, g_viewport_offset + screen_height - g_height, g_width, g_height);
}
else
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
glScissor(0, viewport_offset, g_width, g_height);
glScissor(0, g_viewport_offset, g_width, g_height);
}
else {
if (!render_to_texture) //initialization
@ -1333,7 +1333,7 @@ void updateTexture()
//glDeleteTextures( 1, &pBufferAddress );
glBindTexture(GL_TEXTURE_2D, pBufferAddress);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
0, viewport_offset, g_width, g_height, 0);
0, g_viewport_offset, g_width, g_height, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
//glPopAttrib();
@ -1359,7 +1359,7 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int x, int y, int w, int h,
//glReadBuffer(current_buffer);
glBindTexture(GL_TEXTURE_2D, depth_texture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
0, viewport_offset, tw, th, 0);
0, g_viewport_offset, tw, th, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
return;
}
@ -1422,8 +1422,8 @@ grRenderBuffer(GrBuffer_t buffer)
}
curBufferAddr = 0;
glViewport(0, viewport_offset, g_width, viewport_height);
glScissor(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, viewport_height);
glScissor(0, g_viewport_offset, g_width, g_height);
#ifdef SAVE_CBUFFER
if (!use_fbo && render_to_texture == 2) {
@ -1662,7 +1662,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 4;
info->writeMode = GR_LFBWRITEMODE_888;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer);
}
else {
buf = (unsigned char*)malloc(g_width*g_height * 4);
@ -1671,7 +1671,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_565;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < g_height; j++)
{
@ -1692,7 +1692,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_ZA16;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
}
}
@ -1741,7 +1741,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 4);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < src_height; j++)
{
@ -1759,7 +1759,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 2);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
for (j = 0; j < src_height; j++)
{
@ -1886,7 +1886,7 @@ FxI32 src_stride, void *src_data)
}
else
{
float *buf = (float*)malloc(src_width*(src_height + (viewport_offset))*sizeof(float));
float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset))*sizeof(float));
if (src_format != GR_LFBWRITEMODE_ZA16)
WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format);
@ -1898,14 +1898,14 @@ FxI32 src_stride, void *src_data)
{
for (i = 0; i < src_width; i++)
{
buf[(j + (viewport_offset))*src_width + i] =
buf[(j + (g_viewport_offset))*src_width + i] =
(frameBuffer[(src_height - j - 1)*(src_stride / 2) + i] / (65536.0f*(2.0f / zscale))) + 1 - zscale / 2.0f;
}
}
#ifdef VPDEBUG
if (dumping) {
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (viewport_offset)));
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (g_viewport_offset)));
for (i = 0; i < src_width*src_height; i++)
buf2[i] = buf[i] * 255.0f;
ilTexImage(src_width, src_height, 1, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, buf2);
@ -1924,7 +1924,7 @@ FxI32 src_stride, void *src_data)
//glDrawBuffer(GL_BACK);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(1);
//glDrawPixels(src_width, src_height+(viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
//glDrawPixels(src_width, src_height+(g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
free(buf);
}

View File

@ -1651,7 +1651,7 @@ grChromakeyValue(GrColor_t value)
grDisplayGLError("grChromakeyValue");
}
static void setPattern()
void setPattern()
{
int i;
GLubyte stip[32 * 4];
@ -1690,15 +1690,6 @@ static void setPattern()
grDisplayGLError("setPattern");
}
FX_ENTRY void FX_CALL
grStipplePattern(
GrStipplePattern_t stipple)
{
WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple);
srand(stipple);
setPattern();
}
FX_ENTRY void FX_CALL
grStippleMode(GrStippleMode_t mode)
{

View File

@ -276,7 +276,7 @@ void FindBestDepthBias()
glVertex3fv(vertices[3]);
glEnd();
glReadPixels(x + 2, 2 + viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
glReadPixels(x + 2, 2 + g_viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
z -= 0.75f + 8e-6f;
if (z < 0.0f) z = -z;
if (z > 0.01f) continue;
@ -354,7 +354,7 @@ grDrawTriangle(const void *a, const void *b, const void *c)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -467,7 +467,7 @@ grDrawPoint(const void *pt)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -536,7 +536,7 @@ grDrawLine(const void *a, const void *b)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -612,7 +612,7 @@ grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers2)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -684,7 +684,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 strid
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}

View File

@ -51,8 +51,8 @@ static inline void opt_glCopyTexImage2D(GLenum target,
width = screen_width - x;
//printf("resizing w --> %d\n", width);
}
if (y + height >= screen_height + viewport_offset) {
height = screen_height + viewport_offset - y;
if (y + height >= screen_height + g_viewport_offset) {
height = screen_height + g_viewport_offset - y;
//printf("resizing h --> %d\n", height);
}
glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height);
@ -292,7 +292,7 @@ int default_texture; // the infamous "32*1024*1024" is now configurable
int current_texture;
int depth_texture, color_texture;
int glsl_support = 1;
int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0;
int viewport_width, viewport_height, g_viewport_offset = 0, nvidia_viewport_hack = 0;
int save_w, save_h;
int lfb_color_fmt;
float invtex[2];
@ -382,11 +382,11 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy)
if (int(miny) < 0) miny = 0;
if (maxx < minx) maxx = minx;
if (maxy < miny) maxy = miny;
glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny);
glScissor(minx, miny + g_viewport_offset, maxx - minx, maxy - miny);
//printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy);
}
else {
glScissor(minx, (viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
}
glEnable(GL_SCISSOR_TEST);
grDisplayGLError("grClipWindow");
@ -766,12 +766,12 @@ int nAuxBuffers)
#endif
#ifndef ANDROID
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
viewport_width = g_width;
viewport_height = g_height;
nvidia_viewport_hack = 1;
#else
glViewport(0, viewport_offset, width, height);
glViewport(0, g_viewport_offset, width, height);
viewport_width = width;
viewport_height = height;
#endif // _WIN32
@ -969,26 +969,26 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
if (save_w) {
if (tw > save_w && th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, tw, th - save_h);
0, g_viewport_offset + save_h, tw, th - save_h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
save_h = th;
}
else if (tw > save_w) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
}
else if (th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, save_w, th - save_h);
0, g_viewport_offset + save_h, save_w, th - save_h);
save_h = th;
}
}
else {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
0, viewport_offset, tw, th);
0, g_viewport_offset, tw, th);
save_w = tw;
save_h = th;
}
@ -1037,12 +1037,12 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
//printf("viewport %dx%d\n", width, height);
if (g_height > screen_height) {
glViewport(0, viewport_offset + screen_height - g_height, g_width, g_height);
glViewport(0, g_viewport_offset + screen_height - g_height, g_width, g_height);
}
else
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
glScissor(0, viewport_offset, g_width, g_height);
glScissor(0, g_viewport_offset, g_width, g_height);
grDisplayGLError("grTextureBufferExt :: A");
}
@ -1556,7 +1556,7 @@ void updateTexture()
//glDeleteTextures( 1, &pBufferAddress );
glBindTexture(GL_TEXTURE_2D, pBufferAddress);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
0, viewport_offset, g_width, g_height, 0);
0, g_viewport_offset, g_width, g_height, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
glPopAttrib();
@ -1583,7 +1583,7 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int /*x*/, int /*y*/, int /*w*/, int
glReadBuffer(current_buffer);
glBindTexture(GL_TEXTURE_2D, depth_texture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
0, viewport_offset, tw, th, 0);
0, g_viewport_offset, tw, th, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
grDisplayGLError("grFramebufferCopyExt :: A");
return;
@ -1648,8 +1648,8 @@ grRenderBuffer(GrBuffer_t buffer)
}
curBufferAddr = 0;
glViewport(0, viewport_offset, g_width, viewport_height);
glScissor(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, viewport_height);
glScissor(0, g_viewport_offset, g_width, g_height);
#ifdef SAVE_CBUFFER
if (!use_fbo && render_to_texture == 2) {
@ -1856,7 +1856,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 4;
info->writeMode = GR_LFBWRITEMODE_888;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer);
}
else {
buf = (unsigned char*)malloc(g_width*g_height * 4);
@ -1865,7 +1865,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_565;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < g_height; j++)
{
@ -1886,7 +1886,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_ZA16;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
}
}
@ -1936,7 +1936,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 4);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < src_height; j++)
{
@ -1954,7 +1954,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 2);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
for (j = 0; j < src_height; j++)
{
@ -2082,7 +2082,7 @@ FxI32 src_stride, void *src_data)
}
else
{
float *buf = (float*)malloc(src_width*(src_height + (viewport_offset))*sizeof(float));
float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset))*sizeof(float));
if (src_format != GR_LFBWRITEMODE_ZA16)
WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format);
@ -2094,14 +2094,14 @@ FxI32 src_stride, void *src_data)
{
for (i = 0; i < src_width; i++)
{
buf[(j + (viewport_offset))*src_width + i] =
buf[(j + (g_viewport_offset))*src_width + i] =
(frameBuffer[(src_height - j - 1)*(src_stride / 2) + i] / (65536.0f*(2.0f / zscale))) + 1 - zscale / 2.0f;
}
}
#ifdef VPDEBUG
if (dumping) {
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (viewport_offset)));
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (g_viewport_offset)));
for (i = 0; i < src_width*src_height; i++)
buf2[i] = buf[i] * 255.0f;
ilTexImage(src_width, src_height, 1, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, buf2);
@ -2120,7 +2120,7 @@ FxI32 src_stride, void *src_data)
glDrawBuffer(GL_BACK);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(1);
glDrawPixels(src_width, src_height + (viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
glDrawPixels(src_width, src_height + (g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
free(buf);
}

View File

@ -155,7 +155,7 @@ extern int fog_coord_support;
//extern int pbuffer_support;
extern int glsl_support;
extern unsigned int pBufferAddress;
extern int viewport_width, viewport_height, viewport_offset, nvidia_viewport_hack;
extern int viewport_width, viewport_height, g_viewport_offset, nvidia_viewport_hack;
extern int UMAmode;
void grChromaRangeExt(GrColor_t color0, GrColor_t color1, FxU32 mode);