Skip to content

Commit

Permalink
Preparing for full retail release
Browse files Browse the repository at this point in the history
  • Loading branch information
andon authored and andon committed Jan 25, 2017
1 parent 1212656 commit a99125d
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 52 deletions.
4 changes: 2 additions & 2 deletions include/DLL_VERSION.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


#define TBF_MAJOR 0
#define TBF_MINOR 3
#define TBF_BUILD 5
#define TBF_MINOR 4
#define TBF_BUILD 0
#define TBF_REV 0


Expand Down
3 changes: 2 additions & 1 deletion src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ DllMain (HMODULE hModule,

case DLL_PROCESS_DETACH:
{
if (dll_log != nullptr) {
if (dll_log != nullptr)
{
tbf::SoundFix::Shutdown ();
//tbf::FileIO::Shutdown ();
//tbf::SteamFix::Shutdown ();
Expand Down
4 changes: 2 additions & 2 deletions src/framerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ tbf::FrameRateFix::Init (void)
{
//CommandProcessor* comm_proc = CommandProcessor::getInstance ();

InitializeCriticalSectionAndSpinCount (&alter_speed_cs, 1000UL);
// InitializeCriticalSectionAndSpinCount (&alter_speed_cs, 1000UL);

target_fps = 0;
bink_dll = LoadLibrary (L"bink2w64.dll");
Expand Down Expand Up @@ -282,7 +282,7 @@ tbf::FrameRateFix::Init (void)
void
tbf::FrameRateFix::Shutdown (void)
{
DeleteCriticalSection (&alter_speed_cs);
//DeleteCriticalSection (&alter_speed_cs);

FreeLibrary (kernel32_dll);
FreeLibrary (bink_dll);
Expand Down
10 changes: 6 additions & 4 deletions src/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,17 +784,19 @@ tbf::SoundFix::Init (void)
void
tbf::SoundFix::Shutdown (void)
{
if (! config.audio.enable_fix)
return;
////if (! config.audio.enable_fix)
////return;

//TBF_RemoveHook (pfnCoCreateInstance);
//TBF_RemoveHook (pfnDirectSoundCreate);

FreeLibrary (dsound_dll);
FreeLibrary (ole32_dll);

audio_log->Log (L"Closing log file...");
audio_log->close ();
if (audio_log) {
audio_log->Log (L"Closing log file...");
audio_log->close ();
}
}


Expand Down
166 changes: 123 additions & 43 deletions src/tbt/control_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "command.h"
#include "render.h"
#include "framerate.h"
#include "sound.h"
#include "hook.h"


Expand Down Expand Up @@ -166,24 +167,17 @@ TBFix_DrawConfigUI (void)
ImGui::GetIO ();

ImGui::SetNextWindowPosCenter (ImGuiSetCond_Always);
ImGui::SetNextWindowSizeConstraints (ImVec2 (50, 50), ImGui::GetIO ().DisplaySize);
ImGui::SetNextWindowSizeConstraints (ImVec2 (665, 50), ImVec2 ( ImGui::GetIO ().DisplaySize.x * 0.95f,
ImGui::GetIO ().DisplaySize.y * 0.95f ) );

if (was_reset) {
ImGui::SetNextWindowSize (ImVec2 (50, 50), ImGuiSetCond_Always);
ImGui::SetNextWindowSize (ImVec2 (665, 50), ImGuiSetCond_Always);
was_reset = false;
}

ImGui::Begin ("Tales of Berseria \"Fix\" Control Panel", &show_config, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_ShowBorders);
bool show_config = true;

if (tbf::RenderFix::need_reset.graphics || tbf::RenderFix::need_reset.textures) {
ImGui::SameLine ( ImGui::GetContentRegionAvailWidth () * 0.03333f );
ImGui::PushTextWrapPos ( ImGui::GetCursorPos ().x + ImGui::GetContentRegionAvailWidth () * 0.95f);
ImGui::PushStyleColor ( ImGuiCol_Text, ImColor (0.8f, 0.7f, 0.1f, 1.0f));
ImGui::TextWrapped ( "You have made changes that will not apply until you change Screen Modes in Graphics Settings, "
"or by performing Alt + Tab with the game set to Fullscreen mode.\n" );
ImGui::PopStyleColor ( );
ImGui::PopTextWrapPos ( );
}
ImGui::Begin ("Tales of Berseria \"Fix\" Control Panel", &show_config, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_ShowBorders);

ImGui::PushItemWidth (ImGui::GetWindowWidth () * 0.666f);

Expand Down Expand Up @@ -304,31 +298,49 @@ TBFix_DrawConfigUI (void)

if (ImGui::CollapsingHeader ("Texture Options"))
{
if (ImGui::Checkbox ("Dump Textures", &config.textures.dump)) tbf::RenderFix::need_reset.graphics = true;
if (ImGui::Checkbox ("Generate Mipmaps", &config.textures.remaster)) tbf::RenderFix::need_reset.graphics = true;
if (ImGui::TreeNodeEx ("Quality Settings", ImGuiTreeNodeFlags_DefaultOpen))
{
if (ImGui::Checkbox ("Generate Mipmaps", &config.textures.remaster)) tbf::RenderFix::need_reset.graphics = true;

if (ImGui::IsItemHovered ())
ImGui::SetTooltip ("Eliminates distant texture aliasing and shimmering caused by missing/incomplete mipmaps.");

if (config.textures.remaster)
{
ImGui::TreePush ("");

if (ImGui::IsItemHovered ())
ImGui::SetTooltip ("Eliminates distant texture aliasing");
if (ImGui::Checkbox ("Do Not Compress Generated Mipmaps", &config.textures.uncompressed)) tbf::RenderFix::need_reset.graphics = true;

if (config.textures.remaster) {
ImGui::SameLine (150);
if (ImGui::IsItemHovered ())
ImGui::SetTooltip ("Uses more VRAM, but avoids texture compression artifacts on generated mipmaps.");

ImGui::Checkbox ("Show Loading Activity in OSD During Mipmap Generation", &config.textures.show_loading_text);
ImGui::TreePop ();
}

if (ImGui::Checkbox ("(Uncompressed)", &config.textures.uncompressed)) tbf::RenderFix::need_reset.graphics = true;
ImGui::SliderFloat ("Mipmap LOD Bias", &config.textures.lod_bias, -3.0f, config.textures.uncompressed ? 16.0f : 3.0f);

if (ImGui::IsItemHovered ())
ImGui::SetTooltip ("Uses more VRAM, but avoids texture compression artifacts on generated mipmaps.");
{
ImGui::BeginTooltip ();
ImGui::Text ("Controls texture sharpness; -3 = Sharpest (WILL shimmer), 0 = Neutral, 16 = Laughably blurry");
ImGui::EndTooltip ();
}
ImGui::TreePop ();
}

ImGui::SliderFloat ("LOD Bias", &config.textures.lod_bias, -3.0f, config.textures.uncompressed ? 16.0f : 3.0f);

if (ImGui::IsItemHovered ())
if (ImGui::TreeNode ("Texture Modding"))
{
ImGui::BeginTooltip ();
ImGui::Text ("Controls texture sharpness; -3 = Sharpest (WILL shimmer), 0 = Neutral, 16 = Laughably blurry");
ImGui::EndTooltip ();
}
if (ImGui::Checkbox ("Dump Textures (TBFix_Res\\dump\\textures\\<format>\\*.dds)", &config.textures.dump)) tbf::RenderFix::need_reset.graphics = true;

ImGui::Checkbox ("Display Texture Resampling Indicator in OSD", &config.textures.show_loading_text);
if (ImGui::IsItemHovered ())
{
ImGui::BeginTooltip ();
ImGui::Text ("Enabling this will cause the game to run slower and waste disk space, only enable if you know what you are doing.");
ImGui::EndTooltip ();
}
ImGui::TreePop ();
}
}

#if 0
Expand Down Expand Up @@ -363,8 +375,10 @@ TBFix_DrawConfigUI (void)
ImGui::Combo ("Character Shadow Resolution", &shadows.radio, "Normal\0Enhanced\0High\0Ultra\0\0");
ImGui::Combo ("Environmental Shadow Resolution", &env_shadows.radio, "Normal\0High\0Ultra\0\0");

ImGui::PushStyleColor (ImGuiCol_Text, ImColor (0.999f, 0.01f, 0.999f, 1.0f));
ImGui::TextWrapped (" * Changes to these settings will produce weird results until you change Screen Mode in-game..." );
ImGui::Columns (1);
ImGui::PushStyleColor (ImGuiCol_Text, ImColor (0.975f, 0.1f, 0.975f, 1.0f));
ImGui::Bullet (); ImGui::SameLine ();
ImGui::TextWrapped ("Changes to these settings will produce weird results until you change Screen Mode in-game..." );
ImGui::PopStyleColor ();

if (env_shadows.radio != env_shadows.last_sel) {
Expand All @@ -380,41 +394,102 @@ TBFix_DrawConfigUI (void)
}
}

static bool need_restart = false;

if (ImGui::CollapsingHeader ("Audio Configuration"))
{
ImGui::Checkbox ("Enable 7.1 Channel Audio Fix", &config.audio.enable_fix);
{
if (tbf::SoundFix::wasapi_init) {
ImGui::PushStyleVar (ImGuiStyleVar_ChildWindowRounding, 16.0f);
ImGui::BeginChild ("Audio Details", ImVec2 (0, 80), true);

ImGui::Columns (3);
ImGui::Text (""); ImGui::NextColumn ();
ImGui::Text ("Sample Rate"); ImGui::NextColumn ();
ImGui::Text ("Channel Setup");
ImGui::Columns (1);
ImGui::Separator ();
ImGui::Columns (3);
ImGui::Text ( "Game (SoundCore)"); ImGui::NextColumn ();
ImGui::Text ( "%.2f kHz @ %lu-bit", (float)tbf::SoundFix::snd_core_fmt.nSamplesPerSec / 1000.0f,
tbf::SoundFix::snd_core_fmt.wBitsPerSample ); ImGui::NextColumn ();
ImGui::Text ( "%lu", tbf::SoundFix::snd_core_fmt.nChannels );
ImGui::Columns (1);
ImGui::Separator ();
ImGui::Columns (3);
ImGui::Text ( "Device"); ImGui::NextColumn ();
ImGui::Text ( "%.2f kHz @ %lu-bit", (float)tbf::SoundFix::snd_device_fmt.nSamplesPerSec / 1000.0f,
tbf::SoundFix::snd_device_fmt.wBitsPerSample ); ImGui::NextColumn ();
ImGui::Text ( "%lu", tbf::SoundFix::snd_device_fmt.nChannels );
ImGui::Columns (1);

ImGui::EndChild ();
ImGui::PopStyleVar ();
}

if (config.audio.enable_fix) {
ImGui::RadioButton ("Stereo", (int *)&config.audio.channels, 2);
ImGui::RadioButton ("Quadraphonic", (int *)&config.audio.channels, 4);
ImGui::RadioButton ("5.1 Surround", (int *)&config.audio.channels, 6);
need_restart |= ImGui::Checkbox ("Enable 7.1 Channel Audio Fix", &config.audio.enable_fix);

if (config.audio.enable_fix)
{
ImGui::TreePush ("");
need_restart |= ImGui::RadioButton ("Stereo", (int *)&config.audio.channels, 2); ImGui::SameLine ();
need_restart |= ImGui::RadioButton ("Quadraphonic", (int *)&config.audio.channels, 4); ImGui::SameLine ();
need_restart |= ImGui::RadioButton ("5.1 Surround", (int *)&config.audio.channels, 6);
ImGui::TreePop ( );
}
}

ImGui::PopItemWidth ();

if (ImGui::Button ("Gamepad Config"))
ImGui::Separator ( );
ImGui::Columns ( 2 );

if (ImGui::Button (" Gamepad Config "))
ImGui::OpenPopup ("Gamepad Config");

TBFix_GamepadConfigDlg ();

ImGui::SameLine();
ImGui::SameLine ();

//if (ImGui::Button ("Special K Config"))
//show_gamepad_config ^= 1;

if (ImGui::Button ("Special K Config"))
if (ImGui::Button (" Special K Config "))
show_special_k_cfg = (! show_special_k_cfg);

ImGui::SameLine ();
ImGui::SameLine (0.0f, 60.0f);

if (ImGui::Selectable ("...", show_test_window))
show_test_window = (! show_test_window);

ImGui::NextColumn ();

if ( ImGui::Checkbox ("Pause Game While This Menu Is Open", &config.input.ui.pause) )
TBFix_PauseGame (config.input.ui.pause);

ImGui::SameLine ();
bool extra_details = false;

if (ImGui::Selectable ("...", show_test_window))
show_test_window = (! show_test_window);
if (need_restart || tbf::RenderFix::need_reset.graphics || tbf::RenderFix::need_reset.textures)
extra_details = true;

if (extra_details) {
ImGui::Columns ( 1 );
ImGui::Separator ( );

if (need_restart) {
ImGui::PushStyleColor (ImGuiCol_Text, ImVec4 (1.0f, 0.4f, 0.15f, 1.0f));
ImGui::BulletText ("Game Restart Required");
ImGui::PopStyleColor ();
}

if (tbf::RenderFix::need_reset.graphics || tbf::RenderFix::need_reset.textures) {
ImGui::PushStyleColor (ImGuiCol_Text, ImVec4 (1.0f, 0.8f, 0.2f, 1.0f));
ImGui::Bullet ( ); ImGui::SameLine ();
ImGui::TextWrapped ( "You have made changes that will not apply until you change Screen Modes in Graphics Settings, "
"or by performing Alt + Tab with the game set to Fullscreen mode.\n" );
ImGui::PopStyleColor ( );
ImGui::PopTextWrapPos ( );
}
}

ImGui::End ();

Expand All @@ -433,6 +508,11 @@ TBFix_DrawConfigUI (void)
ImGui::Render ();
tbf::RenderFix::pDevice->EndScene ();
}

if (! show_config)
{
TBFix_ToggleConfigUI ();
}
}


Expand Down
6 changes: 6 additions & 0 deletions src/textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2189,6 +2189,12 @@ D3DXCreateTextureFromFileInMemoryEx_Detour (
bool compressed = (fmt_real >= D3DFMT_DXT1 && fmt_real <= D3DFMT_DXT5);

wchar_t wszPath [MAX_PATH];
_swprintf ( wszPath, L"%s\\dump",
TBFIX_TEXTURE_DIR );

if (GetFileAttributesW (wszPath) != FILE_ATTRIBUTE_DIRECTORY)
CreateDirectoryW (wszPath, nullptr);

_swprintf ( wszPath, L"%s\\dump\\textures",
TBFIX_TEXTURE_DIR );

Expand Down
Binary file modified version.ini
Binary file not shown.

0 comments on commit a99125d

Please sign in to comment.