forked from cafeberry/cafeberry
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c988bd564d | ||
|
|
71a972a033 | ||
|
|
a047df6dc4 | ||
|
|
1763155fc6 | ||
|
|
1a903c65dc | ||
|
|
9d19fdc5f5 | ||
|
|
14cd85e7ed |
@@ -0,0 +1,114 @@
|
||||
name: Build & Release Windows64
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version tag for release (e.g. v1.0.0).'
|
||||
required: true
|
||||
default: ''
|
||||
notes:
|
||||
description: 'URL to notes for release.'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Validate version format
|
||||
run: |
|
||||
if (-not ("${{ inputs.version }}" -match '^v\d+\.\d+\.\d+[a-zA-Z0-9.-]*$')) {
|
||||
Write-Error "Version '${{ inputs.version }}' doesn't match expected format (e.g. v1.0.0)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
build:
|
||||
needs: validate
|
||||
strategy:
|
||||
matrix:
|
||||
configuration: [ContentPackage]
|
||||
platform: [Windows64]
|
||||
include:
|
||||
- platform: Windows64
|
||||
sdk_label: windows-2022 # str1k3r - can run on any runner
|
||||
|
||||
runs-on: [windows-2022, "${{ matrix.sdk_label }}"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
clean: false
|
||||
lfs: false
|
||||
submodules: true
|
||||
|
||||
- name: Build Cafeberry
|
||||
run: |
|
||||
& "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" MinecraftConsoles.sln `
|
||||
/p:Configuration=${{ matrix.configuration }} `
|
||||
/p:Platform=${{ matrix.platform }} `
|
||||
/m
|
||||
|
||||
- name: Zip Build
|
||||
run: |
|
||||
7z a -r "LCEWindows64.zip" "./x64/${{ matrix.configuration }}/*" "-x!*.pdb" "-x!*.pch" "-x!*.ilk" "-x!*.lib" "-x!*.exp"
|
||||
|
||||
- name: Stage artifacts
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path staging
|
||||
Copy-Item "LCE${{ matrix.platform }}.zip" staging/
|
||||
Copy-Item "./x64/${{ matrix.configuration }}/Minecraft.Client.exe" staging/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: build-${{ matrix.platform }}
|
||||
path: staging/*
|
||||
compression-level: 0
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Download all build artifacts
|
||||
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
path: downloaded
|
||||
|
||||
- name: Fetch release notes
|
||||
id: notes
|
||||
run: |
|
||||
$notesSource = "${{ inputs.notes }}"
|
||||
$fallback = "## Cafeberry`n`n### Whoever made this release forgot to put notes, sorry!"
|
||||
|
||||
if ($notesSource -match '^https?://') {
|
||||
try {
|
||||
$body = (Invoke-WebRequest -Uri $notesSource -UseBasicParsing).Content
|
||||
if ([string]::IsNullOrWhiteSpace($body)) { $body = $fallback }
|
||||
} catch {
|
||||
$body = $fallback
|
||||
}
|
||||
} else {
|
||||
$body = $fallback
|
||||
}
|
||||
|
||||
$delimiter = "EOF_$([System.Guid]::NewGuid().ToString('N'))"
|
||||
$content = "description<<$delimiter`n$body`n$delimiter`n"
|
||||
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, $content, $utf8NoBom)
|
||||
|
||||
- name: Publish Release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
name: ${{ inputs.version }}
|
||||
server_url: ${{ gitea.server_url }}
|
||||
repository: ${{ gitea.repository }}
|
||||
token: ${{ gitea.token }}
|
||||
tag_name: ${{ inputs.version }}
|
||||
prerelease: false
|
||||
verbose: true
|
||||
files: downloaded/**/*
|
||||
body: ${{ steps.notes.outputs.description }}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[submodule "Minecraft.Client/Windows64/4JLibs"]
|
||||
path = Minecraft.Client/Windows64/4JLibs
|
||||
url = https://gitea.str1k3r.xyz/pieeebot/Cafeberry-4JLibs
|
||||
url = https://gitea.str1k3r.xyz/cafeberry/4JLibs.git
|
||||
ignore = untracked
|
||||
branch = main
|
||||
|
||||
@@ -875,7 +875,8 @@ enum EControllerActions
|
||||
MINECRAFT_ACTION_SPAWN_CREEPER,
|
||||
MINECRAFT_ACTION_CHANGE_SKIN,
|
||||
MINECRAFT_ACTION_FLY_TOGGLE,
|
||||
MINECRAFT_ACTION_RENDER_DEBUG
|
||||
MINECRAFT_ACTION_RENDER_DEBUG,
|
||||
MINECRAFT_ACTION_RENDER_DEBUG_SCREEN
|
||||
};
|
||||
|
||||
enum eMCLang
|
||||
|
||||
@@ -22,8 +22,7 @@ $folderCopies = @(
|
||||
@{ Source = "music"; Dest = "music" },
|
||||
@{ Source = "Common\res"; Dest = "Common\res" },
|
||||
@{ Source = "Common\Media"; Dest = "Common\Media" },
|
||||
@{ Source = "DurangoMedia"; Dest = "Windows64Media" },
|
||||
@{ Source = "Windows64Media"; Dest = "Windows64Media" },
|
||||
@{ Source = "Windows64Media\DLC"; Dest = "Windows64Media\DLC" },
|
||||
@{ Source = "Windows64Media\Sound"; Dest = "Windows64Media\Sound" },
|
||||
#@{ Source = "PSVita\Tutorial"; Dest = "Windows64Media\Tutorial" }, # str1k3r - doesnt even work bru
|
||||
@{ Source = "Windows64\Miles\lib\redist64"; Dest = "Windows64\redist64" }
|
||||
@@ -47,7 +46,7 @@ foreach ($copy in $folderCopies) {
|
||||
$fileCopies = @(
|
||||
@{ Source = Join-Path $ProjectDir "Windows64\4JLibs\4J_Input\Windows64\vendor\SDL\lib\x64\SDL3.dll"; Dest = "SDL3.dll" },
|
||||
@{ Source = Join-Path $PSScriptRoot "Contents\Windows64\mss64.dll"; Dest = "mss64.dll" },
|
||||
@{ Source = "Windows64\redist64\iggy_w64.dll"; Dest = "iggy_w64.dll" }
|
||||
@{ Source = "Windows64\Iggy\lib\redist64\iggy_w64.dll"; Dest = "iggy_w64.dll" }
|
||||
)
|
||||
|
||||
foreach ($copy in $fileCopies) {
|
||||
|
||||
@@ -2386,7 +2386,7 @@ void CMinecraftApp::ClearGameSettingsChangedFlag(int iPad)
|
||||
// Remove the debug settings in the content package build
|
||||
//
|
||||
////////////////////////////
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
#ifndef _DEBUG_MENUS_ENABLED
|
||||
unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlayer) //bOverridePlayer is to force the send for the server to get the read options
|
||||
{
|
||||
return 0;
|
||||
@@ -2399,9 +2399,7 @@ void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal)
|
||||
void CMinecraftApp::ActionDebugMask(int iPad,bool bSetAllClear)
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlayer) //bOverridePlayer is to force the send for the server to get the read options
|
||||
{
|
||||
if(iPad==-1)
|
||||
@@ -3843,11 +3841,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||
break;
|
||||
case eAppAction_SetDefaultOptions:
|
||||
SetAction(i,eAppAction_Idle);
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
|
||||
SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i);
|
||||
#else
|
||||
SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i);
|
||||
#endif
|
||||
SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i);
|
||||
|
||||
// if the profile data has been changed, then force a profile write
|
||||
// It seems we're allowed to break the 5 minute rule if it's the result of a user action
|
||||
@@ -6455,7 +6449,7 @@ wstring CMinecraftApp::FormatHTMLString(int iPad, const wstring &desc, int shado
|
||||
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_DOWN*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_DOWN ) );
|
||||
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_RIGHT*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_RIGHT ) );
|
||||
text = replaceAll(text, L"{*CONTROLLER_ACTION_DPAD_LEFT*}", GetActionReplacement(iPad,MINECRAFT_ACTION_DPAD_LEFT ) );
|
||||
#if defined _XBOX_ONE || defined __PSVITA__
|
||||
#if defined _XBOX_ONE || defined __PSVITA__ || defined _WINDOWS64
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_START*}", GetVKReplacement(VK_PAD_START ) );
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_BACK*}", GetVKReplacement(VK_PAD_BACK ) );
|
||||
#endif
|
||||
@@ -6578,8 +6572,16 @@ wstring CMinecraftApp::GetActionReplacement(int iPad, unsigned char ucAction)
|
||||
#ifdef __PS3__
|
||||
int size = 30;
|
||||
#elif defined _WIN64
|
||||
int size = 45;
|
||||
if(ui.getScreenWidth() < 1920) size = 30;
|
||||
int size;
|
||||
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
size = 45;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 30;
|
||||
}
|
||||
#else
|
||||
int size = 45;
|
||||
#endif
|
||||
@@ -6691,7 +6693,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey)
|
||||
case VK_PAD_RTHUMB_DOWNLEFT :
|
||||
replacement = L"ButtonRightStick";
|
||||
break;
|
||||
#if defined _XBOX_ONE || defined __PSVITA__
|
||||
#if defined _XBOX_ONE || defined __PSVITA__ || defined _WINDOWS64
|
||||
case VK_PAD_START:
|
||||
replacement = L"ButtonStart";
|
||||
break;
|
||||
@@ -6707,8 +6709,16 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey)
|
||||
#ifdef __PS3__
|
||||
int size = 30;
|
||||
#elif defined _WIN64
|
||||
int size = 45;
|
||||
if(ui.getScreenWidth() < 1920) size = 30;
|
||||
int size;
|
||||
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
size = 45;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 30;
|
||||
}
|
||||
#else
|
||||
int size = 45;
|
||||
#endif
|
||||
@@ -6738,8 +6748,16 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon)
|
||||
#ifdef __PS3__
|
||||
int size = 22;
|
||||
#elif defined _WIN64
|
||||
int size = 33;
|
||||
if(ui.getScreenWidth() < 1920) size = 22;
|
||||
int size;
|
||||
|
||||
if(ui.getScreenWidth() >= 1920)
|
||||
{
|
||||
int size = 33;
|
||||
}
|
||||
else
|
||||
{
|
||||
int size = 22;
|
||||
}
|
||||
#else
|
||||
int size = 33;
|
||||
#endif
|
||||
|
||||
@@ -406,6 +406,12 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD
|
||||
unsigned int uiVersion=*(unsigned int *)pbData;
|
||||
uiCurrentByte+=sizeof(int);
|
||||
|
||||
if(uiVersion > CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
app.DebugPrintf("DLC version of %d is newer than this build can read (%d)\n", uiVersion, CURRENT_DLC_VERSION_NUM);
|
||||
return false;
|
||||
}
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
if(pbData!=NULL) delete [] pbData;
|
||||
@@ -613,6 +619,11 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack)
|
||||
unsigned int uiVersion=*(unsigned int *)pbData;
|
||||
uiCurrentByte+=sizeof(int);
|
||||
|
||||
if(uiVersion > CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
app.DebugPrintf("DLC version of %d is newer than this build can read (%d)\n", uiVersion, CURRENT_DLC_VERSION_NUM);
|
||||
return 0;
|
||||
}
|
||||
if(uiVersion < CURRENT_DLC_VERSION_NUM)
|
||||
{
|
||||
app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion);
|
||||
|
||||
@@ -25,6 +25,8 @@ UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad, void *initD
|
||||
m_labelPressStart.init( (UIString) [] { return replaceAll(app.GetString(IDS_PRESS_X_TO_JOIN), L"{*CONTROLLER_VK_A*}", app.GetVKReplacement(VK_PAD_A) ); });
|
||||
#elif defined _XBOX_ONE
|
||||
m_labelPressStart.init( (UIString) [] { return replaceAll(app.GetString(IDS_PRESS_START_TO_JOIN), L"{*CONTROLLER_VK_START*}", app.GetVKReplacement(VK_PAD_START) ); });
|
||||
#elif defined _WINDOWS64
|
||||
m_labelPressStart.init( (UIString) [] { return replaceAll(app.GetString(IDS_PRESS_START_TO_JOIN), L"{*CONTROLLER_VK_START*}", app.GetVKReplacement(VK_PAD_START) ); });
|
||||
#else
|
||||
m_labelPressStart.init(IDS_PRESS_START_TO_JOIN);
|
||||
#endif
|
||||
|
||||
@@ -454,12 +454,7 @@ void CXuiSceneAbstractContainer::SetPointerText(vector<HtmlString> *description,
|
||||
return;
|
||||
}
|
||||
|
||||
wstring combinedText;
|
||||
for(size_t i = 0; i < description->size(); ++i)
|
||||
{
|
||||
combinedText += (*description)[i].text;
|
||||
if(i + 1 < description->size()) combinedText += L"\n";
|
||||
}
|
||||
wstring combinedText = HtmlString::Compose(description);
|
||||
|
||||
vector<wstring> unformattedStrings;
|
||||
for(size_t i = 0; i < description->size(); ++i)
|
||||
|
||||
@@ -34,12 +34,9 @@
|
||||
#include <perf.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__)
|
||||
#ifdef _WINDOWS64
|
||||
//C4JStorage StorageManager;
|
||||
C_4JProfile ProfileManager;
|
||||
#endif
|
||||
#endif // __PS3__
|
||||
CSentientManager SentientManager;
|
||||
CXuiStringTable StringTable;
|
||||
|
||||
|
||||
@@ -1407,7 +1407,8 @@ void Minecraft::run_middle()
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DPAD_RIGHT)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_CHANGE_SKIN;
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DPAD_UP)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_FLY_TOGGLE;
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DPAD_DOWN)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_RENDER_DEBUG;
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DPAD_LEFT)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_SPAWN_CREEPER;
|
||||
//if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DPAD_LEFT)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_SPAWN_CREEPER;
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DPAD_LEFT)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_RENDER_DEBUG_SCREEN;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -3475,8 +3476,6 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_RENDER_DEBUG)) )
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
|
||||
options->renderDebug = !options->renderDebug;
|
||||
#ifdef _XBOX
|
||||
app.EnableDebugOverlay(options->renderDebug,iPad);
|
||||
#else
|
||||
@@ -3486,6 +3485,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
#endif
|
||||
}
|
||||
|
||||
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_RENDER_DEBUG_SCREEN)) )
|
||||
{
|
||||
options->renderDebug = !options->renderDebug;
|
||||
}
|
||||
|
||||
#if 0 //str1k3r - replaced this DPAD bind for opening the F3 Debug Menu
|
||||
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_SPAWN_CREEPER)) && app.GetMobsDontAttackEnabled())
|
||||
{
|
||||
//shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(Creeper::_class->newInstance( level ));
|
||||
@@ -3494,6 +3499,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
||||
mob->moveTo(player->x+1, player->y, player->z+1, level->random->nextFloat() * 360, 0);
|
||||
level->addEntity(mob);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_FLY_TOGGLE)) )
|
||||
|
||||
@@ -119,9 +119,6 @@ void StringTable::ProcessStringTableData(void)
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("Failed to get language\n");
|
||||
#ifdef _DEBUG
|
||||
__debugbreak();
|
||||
#endif
|
||||
|
||||
isStatic = false;
|
||||
}
|
||||
|
||||
Submodule Minecraft.Client/Windows64/4JLibs updated: f549c757b9...0c24c663ef
@@ -4,6 +4,7 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <shellapi.h>
|
||||
#include "GameConfig\Minecraft.spa.h"
|
||||
#include "..\MinecraftServer.h"
|
||||
#include "..\LocalPlayer.h"
|
||||
@@ -24,10 +25,6 @@
|
||||
#include "..\..\Minecraft.World\ThreadName.h"
|
||||
#include "..\..\Minecraft.Client\StatsCounter.h"
|
||||
#include "..\ConnectScreen.h"
|
||||
//#include "Social\SocialManager.h"
|
||||
//#include "Leaderboards\LeaderboardManager.h"
|
||||
//#include "XUI\XUI_Scene_Container.h"
|
||||
//#include "NetworkManager.h"
|
||||
#include "..\..\Minecraft.Client\Tesselator.h"
|
||||
#include "..\..\Minecraft.Client\Options.h"
|
||||
#include "Sentient\SentientManager.h"
|
||||
@@ -42,12 +39,11 @@
|
||||
|
||||
HINSTANCE hMyInst;
|
||||
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) };
|
||||
|
||||
char chGlobalText[256];
|
||||
uint16_t ui16GlobalText[256];
|
||||
|
||||
#define THEME_NAME "584111F70AAAAAAA"
|
||||
#define THEME_FILESIZE 2797568
|
||||
|
||||
//#define THREE_MB 3145728 // minimum save size (checking for this on a selected device)
|
||||
//#define FIVE_MB 5242880 // minimum save size (checking for this on a selected device)
|
||||
//#define FIFTY_TWO_MB (1024*1024*52) // Maximum TCR space required for a save (checking for this on a selected device)
|
||||
@@ -58,29 +54,58 @@ uint16_t ui16GlobalText[256];
|
||||
#define NUM_PROFILE_SETTINGS 4
|
||||
DWORD dwProfileSettingsA[NUM_PROFILE_VALUES]=
|
||||
{
|
||||
#ifdef _XBOX
|
||||
XPROFILE_OPTION_CONTROLLER_VIBRATION,
|
||||
XPROFILE_GAMER_YAXIS_INVERSION,
|
||||
XPROFILE_GAMER_CONTROL_SENSITIVITY,
|
||||
XPROFILE_GAMER_ACTION_MOVEMENT_CONTROL,
|
||||
XPROFILE_TITLE_SPECIFIC1,
|
||||
#else
|
||||
0,0,0,0,0
|
||||
#endif
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Time Since fAppTime is a float, we need to keep the quadword app time
|
||||
// as a LARGE_INTEGER so that we don't lose precision after running
|
||||
// for a long time.
|
||||
//-------------------------------------------------------------------------------------
|
||||
//str1k3r - request dedicated GPU from AMD and NVIDIA drivers
|
||||
extern "C"
|
||||
{
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
|
||||
}
|
||||
|
||||
BOOL g_isFullscreen = FALSE;
|
||||
BOOL g_bWidescreen = TRUE;
|
||||
BOOL g_bResolutionSetByCMD = FALSE;
|
||||
|
||||
int g_iScreenWidth = 1920;
|
||||
int g_iScreenHeight = 1080;
|
||||
|
||||
static Windows64LaunchArgs ParseLaunchArgs()
|
||||
{
|
||||
Windows64LaunchArgs args = {};
|
||||
args.resolution = 0;
|
||||
|
||||
int argc = 0;
|
||||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
if (argv == nullptr)
|
||||
return args;
|
||||
|
||||
if (argc > 1 && lstrlenW(argv[1]) == 1)
|
||||
{
|
||||
if (argv[1][0] >= L'1' && argv[1][0] <= L'6')
|
||||
args.resolution = argv[1][0] - L'0';
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (_wcsicmp(argv[i], L"-fullscreen") == 0)
|
||||
{
|
||||
args.fullscreen = true;
|
||||
}
|
||||
else if (_wcsicmp(argv[i], L"-resolution") == 0)
|
||||
{
|
||||
if (i + 1 < argc && argv[i + 1][0] >= L'1' && argv[i + 1][0] <= L'6')
|
||||
{
|
||||
args.resolution = argv[++i][0] - L'0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LocalFree(argv);
|
||||
return args;
|
||||
}
|
||||
|
||||
void DefineActions(void)
|
||||
{
|
||||
// The app needs to define the actions required, and the possible mappings for these
|
||||
@@ -624,6 +649,39 @@ void Render()
|
||||
g_pSwapChain->Present( 0, 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Toggle borderless fullscreen
|
||||
// Credits to the smartCMD repo for this
|
||||
// This is the proper way to do this therefore we just took it
|
||||
//--------------------------------------------------------------------------------------
|
||||
void ToggleFullscreen()
|
||||
{
|
||||
const DWORD dwStyle = GetWindowLong(g_hWnd, GWL_STYLE);
|
||||
if (!g_isFullscreen)
|
||||
{
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
if (GetWindowPlacement(g_hWnd, &g_wpPrev) &&
|
||||
GetMonitorInfo(MonitorFromWindow(g_hWnd, MONITOR_DEFAULTTOPRIMARY), &mi))
|
||||
{
|
||||
SetWindowLong(g_hWnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
|
||||
SetWindowPos(g_hWnd, HWND_TOP,
|
||||
mi.rcMonitor.left, mi.rcMonitor.top,
|
||||
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
||||
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong(g_hWnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
|
||||
SetWindowPlacement(g_hWnd, &g_wpPrev);
|
||||
SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
g_isFullscreen = !g_isFullscreen;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Clean up the objects we've created
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -637,8 +695,6 @@ void CleanupDevice()
|
||||
if( g_pd3dDevice ) g_pd3dDevice->Release();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ LPTSTR lpCmdLine,
|
||||
@@ -647,44 +703,46 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
if(lpCmdLine)
|
||||
Windows64LaunchArgs launchArgs = ParseLaunchArgs();
|
||||
|
||||
if(launchArgs.resolution != 0)
|
||||
{
|
||||
if(lpCmdLine[0] == '1')
|
||||
if(launchArgs.resolution == 1)
|
||||
{
|
||||
// 2160p
|
||||
g_iScreenWidth = 3840;
|
||||
g_iScreenHeight = 2160;
|
||||
g_bResolutionSetByCMD = TRUE;
|
||||
}
|
||||
else if(lpCmdLine[0] == '2')
|
||||
else if(launchArgs.resolution == 2)
|
||||
{
|
||||
// 1440p
|
||||
g_iScreenWidth = 2560;
|
||||
g_iScreenHeight = 1440;
|
||||
g_bResolutionSetByCMD = TRUE;
|
||||
}
|
||||
else if (lpCmdLine[0] == '3')
|
||||
else if (launchArgs.resolution == 3)
|
||||
{
|
||||
// 1080p
|
||||
g_iScreenWidth = 1920;
|
||||
g_iScreenHeight = 1080;
|
||||
g_bResolutionSetByCMD = TRUE;
|
||||
}
|
||||
else if(lpCmdLine[0] == '4')
|
||||
else if(launchArgs.resolution == 4)
|
||||
{
|
||||
// 720p
|
||||
g_iScreenWidth = 1280;
|
||||
g_iScreenHeight = 720;
|
||||
g_bResolutionSetByCMD = TRUE;
|
||||
}
|
||||
else if(lpCmdLine[0] == '5')
|
||||
else if(launchArgs.resolution == 5)
|
||||
{
|
||||
// 480p
|
||||
g_iScreenWidth = 640;
|
||||
g_iScreenHeight = 480;
|
||||
g_bResolutionSetByCMD = TRUE;
|
||||
}
|
||||
else if(lpCmdLine[0] == '6')
|
||||
else if(launchArgs.resolution == 6)
|
||||
{
|
||||
// Vita Native, 544p
|
||||
g_iScreenWidth = 960;
|
||||
@@ -693,7 +751,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Initialize global strings
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
@@ -711,6 +768,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(launchArgs.fullscreen)
|
||||
{
|
||||
ToggleFullscreen();
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Main message loop
|
||||
MSG msg = {0};
|
||||
@@ -896,12 +958,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
app.InitGameSettings();
|
||||
|
||||
#if 0
|
||||
//bool bDisplayPauseMenu=false;
|
||||
|
||||
// set the default gamma level
|
||||
float fVal=50.0f*327.68f;
|
||||
RenderManager.UpdateGamma((unsigned short)fVal);
|
||||
#if 0
|
||||
//bool bDisplayPauseMenu=false;
|
||||
|
||||
// load any skins
|
||||
//app.AddSkinsToMemoryTextureFiles();
|
||||
@@ -939,14 +1000,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// Set the default sound levels
|
||||
pMinecraft->options->set(Options::Option::MUSIC,1.0f);
|
||||
pMinecraft->options->set(Options::Option::SOUND,1.0f);
|
||||
|
||||
app.NavigateToScene(XUSER_INDEX_ANY,eUIScene_Intro,&initData);
|
||||
#endif
|
||||
|
||||
// Set the default sound levels
|
||||
pMinecraft->options->set(Options::Option::MUSIC,1.0f);
|
||||
pMinecraft->options->set(Options::Option::SOUND,1.0f);
|
||||
|
||||
//app.TemporaryCreateGameStart();
|
||||
|
||||
//Sleep(10000);
|
||||
@@ -1001,11 +1056,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
app.UpdateTime();
|
||||
PIXBeginNamedEvent(0,"Input manager tick");
|
||||
InputManager.Tick();
|
||||
PIXEndNamedEvent();
|
||||
PIXBeginNamedEvent(0,"Profile manager tick");
|
||||
// ProfileManager.Tick();
|
||||
if (GetFocus())
|
||||
{
|
||||
InputManager.Tick();
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
/*PIXBeginNamedEvent(0,"Profile manager tick");
|
||||
ProfileManager.Tick();
|
||||
PIXEndNamedEvent();*/
|
||||
PIXBeginNamedEvent(0,"Storage manager tick");
|
||||
StorageManager.Tick();
|
||||
PIXEndNamedEvent();
|
||||
@@ -1013,23 +1071,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
RenderManager.Tick();
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// Tick the social networking manager.
|
||||
PIXBeginNamedEvent(0,"Social network manager tick");
|
||||
// CSocialManager::Instance()->Tick();
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// Tick sentient.
|
||||
PIXBeginNamedEvent(0,"Sentient tick");
|
||||
MemSect(37);
|
||||
// SentientManager.Tick();
|
||||
MemSect(0);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
PIXBeginNamedEvent(0,"Network manager do work #1");
|
||||
// g_NetworkManager.DoWork();
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// LeaderboardManager::Instance()->Tick();
|
||||
// LeaderboardManager::Instance()->Tick();
|
||||
// Render game graphics.
|
||||
if(app.GetGameStarted())
|
||||
{
|
||||
@@ -1192,6 +1238,18 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
#if 0
|
||||
PIXEndNamedEvent();
|
||||
#endif
|
||||
isF11Pressed = (GetAsyncKeyState(VK_F11) & 0x8000) != 0;
|
||||
|
||||
if(isF11Pressed && !wasF11Pressed && GetFocus())
|
||||
{
|
||||
ToggleFullscreen();
|
||||
}
|
||||
else if(isF11Pressed && !wasF11Pressed && GetFocus())
|
||||
{
|
||||
ToggleFullscreen();
|
||||
}
|
||||
|
||||
wasF11Pressed = isF11Pressed;
|
||||
|
||||
// 4J-PB - Update the trial timer display if we are in the trial version
|
||||
if(!ProfileManager.IsFullVersion())
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
static bool isF11Pressed = false;
|
||||
static bool wasF11Pressed = false;
|
||||
|
||||
extern BOOL g_bWidescreen;
|
||||
|
||||
extern int g_iScreenWidth;
|
||||
@@ -11,4 +14,10 @@ extern BOOL g_bResolutionSetByCMD;
|
||||
|
||||
extern ID3D11Device* g_pd3dDevice;
|
||||
|
||||
void CleanupDevice();
|
||||
void CleanupDevice();
|
||||
|
||||
struct Windows64LaunchArgs
|
||||
{
|
||||
bool fullscreen;
|
||||
int resolution;
|
||||
};
|
||||
Reference in New Issue
Block a user