1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-05 22:50:23 +00:00

Merge branch 'main' into game-controller-fixes-and-enhancements

This commit is contained in:
Samuel Gomes 2023-10-04 18:47:20 +05:30 committed by GitHub
commit c82dd88ee2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 107 additions and 59 deletions

View file

@ -32176,33 +32176,36 @@ int32 func__mapunicode(int32 ascii_code) {
int32 addone(int32 x) { return x + 1; } // for testing purposes only
qbs *func__os() {
qbs *tqbs;
#ifdef QB64_WINDOWS
# ifdef QB64_32
tqbs = qbs_new_txt("[WINDOWS][32BIT]");
# else
tqbs = qbs_new_txt("[WINDOWS][64BIT]");
# endif
# define QB64_OS_SYSTEM_STR "[WINDOWS]"
#elif defined(QB64_LINUX)
# ifdef QB64_32
tqbs = qbs_new_txt("[LINUX][32BIT]");
# else
tqbs = qbs_new_txt("[LINUX][64BIT]");
# endif
# define QB64_OS_SYSTEM_STR "[LINUX]"
#elif defined(QB64_MACOSX)
# ifdef QB64_32
tqbs = qbs_new_txt("[MACOSX][32BIT][LINUX]");
# else
tqbs = qbs_new_txt("[MACOSX][64BIT][LINUX]");
# endif
# define QB64_OS_SYSTEM_STR "[MACOSX]"
#else
# ifdef QB64_32
tqbs = qbs_new_txt("[32BIT]");
# else
tqbs = qbs_new_txt("[64BIT]");
# endif
# define QB64_OS_SYSTEM_STR ""
#endif
return tqbs;
#ifdef QB64_MACOSX
# define QB64_OS_SYSTEM_EXTRA_STR "[LINUX]"
#else
# define QB64_OS_SYSTEM_EXTRA_STR ""
#endif
#ifdef QB64_32
# define QB64_OS_BITS_STR "[32BIT]"
#else
# define QB64_OS_BITS_STR "[64BIT]"
#endif
#ifdef QB64_ARM
# define QB64_OS_ARCH_STR "[ARM]"
#else
# define QB64_OS_ARCH_STR ""
#endif
// Have the compiler combine all our selections into one string
return qbs_new_txt(QB64_OS_SYSTEM_STR QB64_OS_SYSTEM_EXTRA_STR QB64_OS_BITS_STR QB64_OS_ARCH_STR);
}
int32 func__screenx() {

View file

@ -20,7 +20,7 @@
# define QB64_WINDOWS
// This supports Windows Vista and up
# define _WIN32_WINNT 0x0600
# define WINVER 0x0600
# define WINVER 0x0600
# define QB64_BACKSLASH_FILESYSTEM
# ifdef _MSC_VER
@ -50,6 +50,9 @@
#if !defined(i386) && !defined(__x86_64__)
# define QB64_NOT_X86
# if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64)
# define QB64_ARM
# endif
#endif
#endif

View file

@ -3358,7 +3358,7 @@ if(!qbevent)break;evnt(219);}while(r);
do{
if(!qbevent)break;evnt(221);}while(r);
S_657:;
if ((*__LONG_MACOSX)||new_error){
if ((qbs_cleanup(qbs_tmp_base,*__LONG_MACOSX|func_instr(NULL,func__os(),qbs_new_txt_len("[ARM]",5),0)))||new_error){
if(qbevent){evnt(222);if(r)goto S_657;}
do{
*__LONG_INLINE_DATA= 1 ;

View file

@ -2,7 +2,7 @@
@rem
@rem This NT command script downloads and extracts the latest copy of MINGW binaries from:
@rem https://github.com/niXman/mingw-builds-binaries/releases
@rem So, the filenames in 'url' variable should be updated to the latest stable builds when those are available
@rem So, the filenames in 'URL' variable should be updated to the latest stable builds when those are available
@rem
@rem Specifying 32 for argument 1 on a 64-bit system will force a 32-bit MINGW setup
@rem
@ -39,41 +39,83 @@ if not exist "internal\c\c_compiler\" (
goto end
)
rem Check the processor type and then set the MINGW variable to the correct MINGW arch
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set MINGW=mingw32 || set MINGW=mingw64
rem Check the processor type and then set the ARCH variable to the processor type
rem These values are from https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor#properties
set "ARCH="
wmic cpu get architecture | find "0" > nul && set ARCH=X86
wmic cpu get architecture | find "5" > nul && set ARCH=ARM
wmic cpu get architecture | find "9" > nul && set ARCH=X86
wmic cpu get architecture | find "12" > nul && set ARCH=ARM
rem If the OS is 32-bit then proceed to download right away
rem Else check if 32 was passed as a parameter. If so, download 32-bit MINGW on a 64-bit system
if "%MINGW%"=="mingw64" if "%~1"=="32" set MINGW=mingw32
rem Set the correct file to download based on processor type
if "%MINGW%"=="mingw32" (
set url="https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/i686-13.1.0-release-win32-dwarf-msvcrt-rt_v11-rev1.7z"
) else (
set url="https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/x86_64-13.1.0-release-win32-seh-msvcrt-rt_v11-rev1.7z"
rem Check if this is an alien processor
if "%ARCH%" == "" (
echo Error: Unknown processor type!
goto end
)
rem Download 7zr.exe. We'll need this to extract the MINGW archive
echo Downloading 7zr.exe...
curl -L https://www.7-zip.org/a/7zr.exe -o 7zr.exe
rem Check the processor type and then set the BITS variable
wmic os get osarchitecture | find /i "64-bit" > nul && set BITS=64 || set BITS=32
rem Download the MINGW archive
echo Downloading %url%...
curl -L %url% -o temp.7z
echo %ARCH%-%BITS% platform detected.
rem Extract the MINGW binaries
echo Extracting C++ Compiler...
7zr.exe x temp.7z -y
rem Check if "32" was passed as an argument and if so set BITS to 32
if "%~1" == "32" set BITS=32
echo %ARCH%-%BITS% platform selected.
rem Set some critical variables before we move to the actual setup part
rem MINGW_DIR is actually the internal directory name inside the zip / 7z file
rem It needs to be updated whenever the toolchains are updated
if "%ARCH%" == "ARM" (
if %BITS% == 64 (
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20230919/llvm-mingw-20230919-ucrt-aarch64.zip"
set MINGW_DIR=llvm-mingw-20230919-ucrt-aarch64
) else (
set URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20230919/llvm-mingw-20230919-ucrt-armv7.zip"
set MINGW_DIR=llvm-mingw-20230919-ucrt-armv7
)
set MINGW_TEMP_FILE=temp.zip
) else (
if %BITS% == 64 (
set URL="https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/x86_64-13.1.0-release-win32-seh-msvcrt-rt_v11-rev1.7z"
set MINGW_DIR=mingw64
) else (
set URL="https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/i686-13.1.0-release-win32-dwarf-msvcrt-rt_v11-rev1.7z"
set MINGW_DIR=mingw32
)
set MINGW_TEMP_FILE=temp.7z
)
rem Download MingW files
if exist %MINGW_TEMP_FILE% del %MINGW_TEMP_FILE%
echo Downloading %URL%...
curl -L %URL% -o %MINGW_TEMP_FILE%
rem Extract MingW files
if "%ARCH%" == "ARM" (
rem Use tar to extract the zip file on Windows on ARM. tar is available in Windows since build 17063
rem And this includes all ARM64 Windows versions
echo Extracting C++ Compiler...
tar -xvf %MINGW_TEMP_FILE%
) else (
rem Download 7zr.exe. We'll need this to extract the MINGW archive
echo Downloading 7zr.exe...
curl -L https://www.7-zip.org/a/7zr.exe -o 7zr.exe
rem Extract the MINGW binaries
echo Extracting C++ Compiler...
7zr.exe x %MINGW_TEMP_FILE% -y
del 7zr.exe
)
rem Move the binaries to internal\c\c_compiler\
echo Moving C++ compiler...
for /f %%a in ('dir %MINGW% /b') do move /y "%MINGW%\%%a" internal\c\c_compiler\
for /f %%a in ('dir %MINGW_DIR% /b') do move /y "%MINGW_DIR%\%%a" internal\c\c_compiler\
rem Cleanup downloaded temporary files
echo Cleaning up...
rd %MINGW%
del 7zr.exe
del temp.7z
rd %MINGW_DIR%
del %MINGW_TEMP_FILE%
rem The End!
:end

View file

@ -27,21 +27,21 @@ cd %~dp0
rem Check if the C++ compiler is there and skip MINGW setup if it exists
if exist "internal\c\c_compiler\bin\c++.exe" goto build_qb64pe
rem Check the processor type and then set the ARCH variable
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set ARCH=32 || set ARCH=64
rem Check the processor type and then set the BITS variable
wmic os get osarchitecture | find /i "64-bit" > nul && set BITS=64 || set BITS=32
rem If the OS is 32-bit then proceed to download right away
if %ARCH% == 32 goto setup_mingw
if %BITS% == 32 goto setup_mingw
rem Check if the user wants to use 32-bit MINGW on a 64-bit system. Default to 64-bit after 60 seconds
choice /t 60 /c 12 /d 1 /m "Do you prefer to download MINGW [1] 64-bit (default) or [2] 32-bit"
if %errorlevel% == 2 set ARCH=32
choice /t 60 /c 12 /d 1 /m "Do you prefer to download MinGW [1] 64-bit (default) or [2] 32-bit"
if %errorlevel% == 2 set BITS=32
:setup_mingw
rem Call the MINGW setup script using the ARCH variable
rem Call the MINGW setup script using the BITS variable
pushd .
call setup_mingw.cmd %ARCH%
call setup_mingw.cmd %BITS%
popd
rem Finally check if the C++ compiler is there now
@ -55,14 +55,14 @@ if not exist "internal\c\c_compiler\bin\c++.exe" (
rem Run make clean
echo Cleaning...
internal\c\c_compiler\bin\mingw32-make.exe OS=win clean > NUL 2> NUL
internal\c\c_compiler\bin\mingw32-make.exe OS=win clean > nul 2> nul
rem Now build QB64-PE
echo Building QB64-PE...
internal\c\c_compiler\bin\mingw32-make.exe OS=win BUILD_QB64=y || goto report_error
rem Execute QB64-PE only if there are no parameters
if "%~1"=="" (
if "%~1" == "" (
echo.
echo Launching QB64-PE...
qb64pe.exe

View file

@ -219,7 +219,7 @@ DIM SHARED MacOSX AS LONG
IF INSTR(_OS$, "[MACOSX]") THEN MacOSX = 1
DIM SHARED inline_DATA
IF MacOSX THEN inline_DATA = 1
IF MacOSX OR INSTR(_OS$, "[ARM]") THEN inline_DATA = 1
DIM SHARED BATCHFILE_EXTENSION AS STRING
BATCHFILE_EXTENSION = ".bat"