• Welcome to MX Bikes Official Forum. Please login or sign up.
 
March 28, 2024, 02:22:09 PM

News:

MX Bikes beta18j available! :)


[RELEASE] iNsane's MX Bikes Background Randomizer v0.1

Started by iNsane, December 06, 2020, 02:18:08 PM

Previous topic - Next topic

iNsane

December 06, 2020, 02:18:08 PM Last Edit: December 15, 2020, 09:50:38 AM by iNsane | WW


Something I've had laying around on my disk for quite long, decided to convert the .BAT to an .EXE and release it in its current state as I got asked quite frequently if there's something similiar.

This little .EXE is a launcher for MX Bikes which works as a little background watcher.

By running the randomizer a console window will pop up and return some lines which are the first initial setup. This setup does following steps:
- create UI folder if not existing
- create loading_screens folder inside UI folder if not existing
- copies the example.tga (which gets extracted on every startup, but removed after initial setup) into the loading_screens folder
- start MX Bikes

The tool fires up the mxbikes.exe and waits 15 seconds before going into the loop. If MX Bikes has been closed (the process has been killed) the tool will detect that and close itself, too.

After the first run the only thing that the tool does is starting mxbikes.exe, waiting for it to load, and then picking a random image from the loading_screens folder each 5s. The tool copies the random image to the ui folder as "bkgrnd.tga" (piboso background image) and "bg.tga" (for the UI I'm currently working on). The splash screen stays untouched.

This tool does NOT change the appearance in the bike selection screen. That thing is whole 3d scene.

Installation:
The .EXE must be placed where your MX Bikes is installed to. E.g. C:\Program Files (x86)\Steam\steamapps\common\MX Bikes\

Add own backgrounds:
Open an image you like in GIMP or Photoshop and make sure the image is 16:9, otherwise it'll be stretched.
Save it as 24bit (truecolor) TGA to the ui\loading_screens\ folder.
The filename is not important, it can be whatever as the tool just scans for .TGA files inside said folder.

An example of my folder:


Download:
EXE Hosted on MXB-Mods.com FTP (Windows defender might see it as Trojan ... it is not.)
How to exclude files from Windows Defender (should work similiar with other Antivirus tools).

Alternative Download:
BAT Hosted on MXB-Mods.com FTP
Unpack the .BAT and the .TGA into your MX Bikes installation directory.

Source code below.


   🌐 MX Bikes custom content
MXB-Mods.com

   📚 MX Bikes User Wiki
MXB-Wiki.com

   💸 Feel free to donate
PayPal

iNsane

December 06, 2020, 02:19:08 PM #1 Last Edit: December 15, 2020, 09:38:43 AM by iNsane | WW
Converted to .EXE with "Bat To Exe Converter v3.2"
@echo off
setlocal EnableDelayedExpansion
set mxbpath=%~dp0mxbikes.exe
set uipath=%~dp0ui
set backgroundpath=%uipath%\loading_screens
title MX Bikes Background Randomizer

if not exist "%uipath%" (
echo UI Path doesn't exist. Creating.
echo.
mkdir "%uipath%" > nul
)

if not exist "%backgroundpath%" (
echo ui\loading_screens folder doesn't exist. Creating.
echo.
mkdir "%backgroundpath%" > nul
)

for /F %%i in ('dir /b "%backgroundpath%\*.*"') do (
   del example.tga
   goto :RUN
)
echo Folder is empty or does not exist

if not exist "%backgroundpath%\example.tga" (
echo Example image doesn't exist. Copying.
echo.
move example.tga "%backgroundpath%\example.tga" > nul
)

:RUN
tasklist /FI "IMAGENAME eq mxbikes.exe" 2>NUL | find /I /N "mxbikes.exe">NUL
if "%ERRORLEVEL%"=="1" (
start "" "%mxbpath%"

:WAIT
echo Waiting for MXBikes.exe to start
tasklist /FI "IMAGENAME eq mxbikes.exe" 2>NUL | find /I /N "mxbikes.exe">NUL
timeout 15 > nul
)

echo Found MXBikes.exe process, starting to cycle through backgrounds now.
echo Background folder: %backgroundpath%
echo.

:START

tasklist /FI "IMAGENAME eq mxbikes.exe" 2>NUL | find /I /N "mxbikes.exe">NUL
if "%ERRORLEVEL%"=="1" (
echo.
echo MX Bikes is not running, quitting
timeout 2 > nul
goto EXIT
)

set /A "rand=(n*%random%)/32768+1"
for %%f in ("%backgroundpath%\*.tga") do (
   set /A n+=1
   set "file[!n!]=%%f"
   set "name[!n!]=%%~nf"
)

set usename=!name[%rand%]!.tga
TITLE %USENAME%
echo using %usename%
copy "!file[%rand%]!" "%uipath%\bkgrnd.tga" > nul
copy "!file[%rand%]!" "%uipath%\bg.tga" > nul

timeout 5 > nul

goto START

:EXIT

exit


   🌐 MX Bikes custom content
MXB-Mods.com

   📚 MX Bikes User Wiki
MXB-Wiki.com

   💸 Feel free to donate
PayPal

fridgedollar


GreenLenux

If you want a custom graphic kit, feel free to contact me with Discord: GreenLenux#2125
Want to support me? You can buy me a coffee here!

LastFriday


iNsane

12/15/2020:
- added .BAT file link

Since the .BAT is converted to .EXE so I am able to include the example.tga and an Icon into the deployment, some AV softwares see that as harmful. It's 100% not harmful.

Here's how to exclude a file from your Windows Defender:
https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26


   🌐 MX Bikes custom content
MXB-Mods.com

   📚 MX Bikes User Wiki
MXB-Wiki.com

   💸 Feel free to donate
PayPal