BAM FPLoader
BAM FPLoader emulates Future Pinball tables. It reads 22 files, 1 of them required: without a required file it does not start games.
About this profile
Technical notes
BAM, Better Arcade Mode, by Rafal Janicki. FPLoader.exe starts Future Pinball.exe suspended, writes the BAM.dll path into the new process with VirtualAllocEx and WriteProcessMemory, runs LoadLibraryA on it through CreateRemoteThread, waits for that thread and resumes the main one. Everything else lives in BAM.dll, which detours the running program. The loader is published as source, and the shipped FPLoader.exe carries the same .text and .rdata as the build committed to that repository and differs only by an Authenticode blob, 9472 bytes against 5384. ref: BAM_FPloader FPLoader.cpp:259-305, FPLoader.exe .text sha1 d5ca74154fe97002, PE timestamp 2016-04-25 19:17:12
BAM.dll is searched in the loader's own directory first, then in C:\Games\Future Pinball\BAM. Both missing puts up "Couldn't locate BAM.dll." and returns -1. Future Pinball.exe comes from /FPEXE if that switch names an existing file, otherwise from one level above the loader, then from the loader's directory, then from C:\Games\Future Pinball. The same failure path reports "Couldn't locate Future Pinball.exe.". Before the process is created the loader prepends its own directory to %PATH% so the system resolves renderingengine.dll from there while the working directory is the game directory. /STAYINRAM keeps the loader alive until the game thread ends. The rest of the command line is handed to Future Pinball untouched, which is how /Open, /Play, /Exit and /ArcadeRender reach it. ref: BAM_FPloader FPLoader.cpp:40-48, 87-111, 166-240, 249-257
BAM.dll is closed source. The copy in BAM_v1.5-408.zip, served by ravarcade.pl, has sha256 f3163c34adc3423d0b4c1f64399a91d090b4f7d0c54dc35049833466645645f7. Its version resource reads 1.5.408 and its debug tags name BAM.cpp, dllmain.cpp, BallManager.cpp, RenderEngine.cpp, plugin.cpp, pbo.cpp, stereo3d.cpp and debug.cpp. Twenty five entry points are detoured in one pass: CreateFileA, CreateFileW, ReadFile, WriteFile, CloseHandle, GetFileSize, DeleteFileA, FindResourceA, LoadResource, LockResource, SizeofResource, CoCreateInstance, StgOpenStorage, GetOpenFileNameA, ChooseColorA, GetDlgItem, SendMessageA, ShowWindow, SwapBuffers, ChoosePixelFormat, SetPixelFormat, wglCreateContext, wglDeleteContext, wglMakeCurrent and wglGetProcAddress, with glFrustum, glTexImage2D and wglChoosePixelFormatARB taken separately. That is how BAM sees the program's own resource and file traffic and can answer it. Newton is reached through GetModuleHandleA on the copy Future Pinball already imported followed by GetProcAddress on 83 entry points. No second copy is loaded. ref: BAM.dll 1.5-408 .text:0x10082a75-0x10082f3d, 0x100831b3-0x100831d9, 0x1002ab92-0x1002abeb, .rsrc version, debug tags Routed_glTexImage2D and Routed_wglChoosePixelFormatARB
Every path BAM builds hangs off the directory holding BAM.dll. The module handle saved at load time goes through GetModuleFileNameA, the result is cut at the last separator, and one of two format strings finishes the job: "%s%s.%s" for a name and an extension, "%s%s" for the cfg subdirectory. Settings for a table are cfg<table>.cfg and cfg<table>.seq, with default.cfg and default.seq as the fallbacks. ref: BAM.dll 1.5-408 .text:0x10025e40-0x1002605a, 0x100319a0-0x10031d48, 0x10032bdb-0x10032f23
Keys are the one text file. bam.cfg is read with fopen_s and parsed as "%s = %s" lines over the names Menu, Menu2, Left, Right, Up, Down, Enter, Snapshot, 3DSwitch, SaveXML, SnapShotPath, SnapShotBackboxPath, HeadTracking, ForceArcadeMode, SwitchToNextBall, SwitchToPrevBall, RoomOnOff, Cam, Overlay, BallShadows and OverlayAspectFix. A Keyboard.cfg found beside it is renamed to bam.cfg first. RetroBat rewrites the two SnapShotPath lines before launching. ref: BAM.dll 1.5-408 .text:0x100c3960-0x100c3a97, .rdata:0x10654208-0x10654324, retrobat emulatorLauncher/Generators/Fpinball.Generator.cs:183-209
A ball or a room is a zip of BMP/<id>.bmp entries named for the resource ids Future Pinball itself uses: the program carries 29 resources of type BMP and every id the shipped packs contain is one of them, 452 being the ball. balls*.zip is walked with FindFirstFileA and each hit becomes a choice in the menu, while default.zip in the BAM directory is applied without being chosen. The routed FindResourceA answers the nine SHADERS resources the same way, while the single XML resource, id 464, is read straight from the program by the save path and is what the presets under XML\ are edited copies of. The 83 GLSL programs BAM renders with are resources of type TEXT inside BAM.dll, so no shader file is read from disk. ref: BAM.dll 1.5-408 FUN_1002d470 0x1002d4ff-0x1002d58b, FUN_1002d0d0 0x1002d2b8-0x1002d33c, FUN_100ae3b0 0x100ae8ec-0x100ae990, 0x10037130-0x100371de, 0x1007e83b-0x1007e896, .rsrc TEXT, Future Pinball.exe 1.9.1.20101231 .rsrc BMP, SHADERS, XML
Plugins are loaded by changing the working directory to plugins, walking *.dll with FindFirstFileA and calling LoadLibraryA on each under SetErrorMode(SEM_FAILCRITICALERRORS). A module without BAM_load is freed, so a plugin whose own imports are missing is skipped and BAM carries on. The rest get BAM_PluginStart, BAM_PluginStop, BAM_GetCOM and the other entry points bound. BAM_Plugins, published by the same author, holds the source of the OpenVR and PostFX plugins and the common header, read at commit aa27aa3a. A plugin keeps its settings by writing a raw structure to <its own name>.cfg in that working directory, which is why the cfg files beside the plugins carry no text. ref: BAM.dll 1.5-408 FUN_100cf360 0x100cf3d2-0x100cf48c (GetModuleFileNameA, plugins, *.dll, _getcwd, _chdir, FindFirstFileA), 0x100cf74f-0x100cf767 (SetErrorMode, LoadLibraryA), 0x100cf78e-0x100cf7aa (BAM_load, FreeLibrary), 0x100cf7cf-0x100cf8c7 (BAM_PluginStart, BAM_PluginStop, BAM_GetCOM), BAM_Plugins Common/BAM.h:117-157
renderingengine.dll is bound in BAM.dll's import directory through FindProgram, SetModuleWithResources, LoadFileToMemory and SaveFileFromMemory, so the loader resolves it before any BAM code runs. It carries Assimp, zlib, libpng and libjpeg, reads the zip packs and writes the per table shadow cache under Cache. ref: BAM.dll 1.5-408 import descriptor renderingengine.dll IAT 0x1055ea0c-0x1055eb1f (69 functions, no delay-load directory), FUN_1007d650 0x1007dccd-0x1007dcd6 (SetModuleWithResources, RE::Init), FUN_101053d0 0x10105c65-0x10105cca (Cache%s-shadows, %s%s.%s with zip), 0x10105df9 (LoadFileToMemory)
ES-DE declares the emulator as FUTURE-PINBALL-FPLOADER for Windows only, finding FPLoader.exe under BAM, BAM-OpenVR\ or BAM-OpenVR-OC, and invokes it with /Exit /Play /Open in the background. RetroBat reaches the same binary under the emulator or core key bam, through the generator it shares with Future Pinball. Two distributions are served: bam-setup.exe carries the loader, the mod, the renderer, the tools, the plugins, the ball packs and the physics presets, while BAM-OpenVR.zip carries the OpenVR plugin and the settings files the other package leaves for the first save to create. ref: es-de resources/systems/windows/es_find_rules.xml:448-461, es-de resources/systems/windows/es_systems.xml:764, retrobat emulatorLauncher/Generators/Fpinball.Generator.cs:131-135
22 files: 1 required, 21 optional. 51 more files come with the app.
By kind: 41 BIOS and 32 game data.
In this collection: 21 in repo, 0 missing and 1 unsourceable.
Required
Section titled “Required”| File | Status |
|---|---|
Future Pinball.exeThe program BAM starts and modifies
Source
|
in repo |
Optional
Section titled “Optional”| File | Status |
|---|---|
bam.cfgKey bindings and screenshot paths, the one text config
Source
|
in repo |
default.cfgGlobal camera, lighting, physics and rendering settings
Source
|
in repo |
default.xmlPhysics values applied when a table specifies none
Source
|
in repo |
XML_Presets.txtList of physics documents offered in the presets menu
Source
|
unsourceable |
Reality.datPhysical measurements of the cabinet and the screen
Source
|
in repo |
WiiMoteCams.datWiiMote identifiers kept for the WiiMote camera mode
Source
|
in repo |
CalibrationBoardData.cfgDimensions of the printed board used to calibrate cameras
Source
|
in repo |
stereoCalibrationData.cfgResult of the two camera calibration pass
Source
|
in repo |
DesktopCam.dllHead tracking from any webcam, desktop geometry
Source
|
in repo |
Simple Cam.dllHead tracking from any webcam, cabinet geometry
Source
|
in repo |
PS3Eye.dllHead tracking from a PlayStation Eye
Source
|
in repo |
DesktopPS3Eye.dllPlayStation Eye tracking with desktop geometry
Source
|
in repo |
PinballHighScore.dbScore database the plugin opens by name
Source
|
in repo |
OpenVR.dllRenders the table to an OpenVR headset
Source
|
in repo |
openvr_api.dllValve OpenVR runtime interface
Source
|
in repo |
opencv_ffmpeg2410.dllOpenCV 2.4.10 FFmpeg bridge, video files as a camera source
Source
|
in repo |
CLEyeMulticam.dllCL-Eye Platform SDK driver interface for the PlayStation Eye
Source
|
in repo |
Kinect10.dllKinect for Windows SDK 1.x runtime
Source
|
in repo |
Kinect20.dllKinect for Windows SDK 2.0 runtime
Source
|
in repo |
NPClient.dllNaturalPoint TrackIR client library
Source
|
in repo |
Game data
Section titled “Game data”| File | Status |
|---|---|
default.zipTexture pack applied to every table
Source
|
optional in repo game data |
Comes with the app
Section titled “Comes with the app”| File | Status | Hash |
|---|---|---|
BAM.dllThe mod, injected into Future Pinball and holding every feature
Hashes and source
|
- | SHA1 ad5f6f31e506 |
renderingengine.dllRendering engine and asset loader behind BAM
Hashes and source
|
- | SHA1 b471bb4affb9 |
BAM-Tracker.exeHead tracking calibration host
Hashes and source
|
- | SHA1 c4fc4467ccec |
ModelImporter.exeConverts models to the .fpm form tables import
Hashes and source
|
- | SHA1 dd3874742bfe |
default.seqCamera animation sequences used when a table brings none
Hashes and source
|
game data | SHA1 bcc92f9af26a |
axis.zipBall texture showing the rotation axes
Hashes and source
|
game data | SHA1 b701f91eae62 |
Baseball.zipBaseball ball texture
Hashes and source
|
game data | SHA1 badfe5b7ab16 |
Basketball 1.zipBasketball ball texture
Hashes and source
|
game data | SHA1 5aff2d72c317 |
Basketball 2.zipSecond basketball ball texture
Hashes and source
|
game data | SHA1 1fa517b848c6 |
Cue Black.zipBlack cue ball texture
Hashes and source
|
game data | SHA1 9238286e57f3 |
Cue White.zipWhite cue ball texture
Hashes and source
|
game data | SHA1 948eec0af661 |
earth.zipGlobe ball texture, three BMP resources
Hashes and source
|
game data | SHA1 0b30d717df74 |
EYETOY.zipEyeToy ball texture
Hashes and source
|
game data | SHA1 89d8f2904817 |
Fireball.zipFireball ball texture
Hashes and source
|
game data | SHA1 28a08c3911ef |
Knight.zipKnight ball texture
Hashes and source
|
game data | SHA1 969d38e02a67 |
latlong.zipLatitude and longitude grid ball texture
Hashes and source
|
game data | SHA1 d2f65f0f32e2 |
Soccer Ball 1.zipSoccer ball texture
Hashes and source
|
game data | SHA1 0a1e886e991d |
fp-p1.0.xmlPhysics 1.0 preset
Hashes and source
|
game data | SHA1 534a239cb7ae |
fp-p2.0.xmlPhysics 2.0 preset
Hashes and source
|
game data | SHA1 db023400242b |
fp-p2.1.xmlPhysics 2.1 preset
Hashes and source
|
game data | SHA1 22ffd7dc5541 |
fp-p2.2.xmlPhysics 2.2 preset
Hashes and source
|
game data | SHA1 fd56e59a4d36 |
fp-p2.3 Version 1.xmlPhysics 2.3 preset, first variant
Hashes and source
|
game data | SHA1 33970a777762 |
fp-p2.3 Version 2.xmlPhysics 2.3 preset, second variant
Hashes and source
|
game data | SHA1 2b0792a18766 |
fp-p2.4.xmlPhysics 2.4 preset
Hashes and source
|
game data | SHA1 ce9ab342ac87 |
fp-p2.5.xmlPhysics 2.5 preset
Hashes and source
|
game data | SHA1 716e15712d96 |
fp-p2.5 slamtilt rubbers.xmlPhysics 2.5 preset with the slamtilt rubber values
Hashes and source
|
game data | SHA1 b1e1764011da |
fp-p2.6.xmlPhysics 2.6 preset
Hashes and source
|
game data | SHA1 f6abf69d826b |
fp-p2.7.xmlPhysics 2.7 preset
Hashes and source
|
game data | SHA1 468826d947e5 |
Zendonius_v1.0.xmlZendonius physics preset
Hashes and source
|
game data | SHA1 694f2c0efa61 |
Zendonius_v1.1.xmlZendonius physics preset, second revision
Hashes and source
|
game data | SHA1 213244dc655f |
zedonius_v1_0.zipTexture pack for the Zendonius preset, resources 315 to 464
Hashes and source
|
game data | SHA1 2563528f492e |
zedonius_v1_1.zipTexture pack for the second Zendonius revision
Hashes and source
|
game data | SHA1 f58591186891 |
HT-PS3Eyes.dllTwo PlayStation Eye cameras tracking an infrared marker
Hashes and source
|
- | SHA1 61b0ff683276 |
Kinect.dllHead tracking from a Kinect for Xbox 360
Hashes and source
|
- | SHA1 f7a2c21d2acc |
DesktopKinect.dllKinect tracking with desktop geometry
Hashes and source
|
- | SHA1 19a04dbf9f43 |
Kinect2.dllHead tracking from a Kinect for Windows v2
Hashes and source
|
- | SHA1 22e32cd595f8 |
FaceTrackLib.dllMicrosoft face tracking library used by the Kinect plugins
Hashes and source
|
- | SHA1 3e96611e075c |
FaceTrackData.dllModel data for the face tracking library
Hashes and source
|
- | SHA1 aeb806a4330c |
FreeTrack.dllHead tracking from a FreeTrack server
Hashes and source
|
- | SHA1 8bb00560edc9 |
TrackIR.dllHead tracking from a NaturalPoint TrackIR
Hashes and source
|
- | SHA1 000deaf4533b |
PostFX.dllBloom and the unfinished ambient occlusion pass
Hashes and source
|
- | SHA1 52a49fdbb932 |
PostFX.cfgSettings block of the PostFX plugin
Hashes and source
|
- | SHA1 a191e0c95a4e |
PinballHighScore.dllRecords high scores across tables
Hashes and source
|
- | SHA1 7734aecaa3cd |
PinballHighScore.cfgSettings block the high score plugin reads and writes
Hashes and source
|
- | SHA1 852b39ba5db6 |
PuPPlugin.dllPuPCOM script object drawing PinUP Player video onto table textures
Hashes and source
|
- | SHA1 972607482b16 |
icom.dllGives a table script the COM objects the cabinet stack exposes
Hashes and source
|
- | SHA1 83a3b55b2cc1 |
iCom.cfgSecurity level setting of the icom plugin
Hashes and source
|
- | SHA1 0aaf76f425c6 |
OpenVR.cfgSettings block of the OpenVR plugin
Hashes and source
|
- | SHA1 21cedece67cf |
haarcascade_frontalface_alt.xmlOpenCV Haar cascade for frontal faces
Hashes and source
|
game data | SHA1 035eef24478e |
haarcascade_frontalface_default.xmlSecond OpenCV Haar cascade for frontal faces
Hashes and source
|
game data | SHA1 85a317ce2fc0 |
lbpcascade_frontalface.xmlOpenCV local binary pattern cascade for frontal faces
Hashes and source
|
game data | SHA1 d668cbe8712f |
Profile data
Section titled “Profile data”Source analysis
-
written not read:
-
note: Opened only for writing, so they are output rather than something to obtain. All of them sit in the BAM directory.
-
entries:
- what: cfg<table>.cfg and cfg<table>.seq, per table settings and camera sequences, source ref: offset
0x10025e59inBAM.dll 1.5-408 .textx10025e59, offset0x100319b9inBAM.dll 1.5-408 .text, offset0x10032bdbinBAM.dll 1.5-408 .text, note: Built as cfg\<table> then finished with the extension. Saved from the menu and read back on the next launch of the same table. - what: Cache<table>-shadows.zip, precomputed shadow maps, source ref: offset
0x10105c18-0x1010697finBAM.dll 1.5-408 .textx10105c18-0x1010697f, note: Checked with GetFileAttributesA and rebuilt when absent. Holds shadowmaps.txt and one <name>-shadows.tga per light, written through the rendering engine. - what: set3points.dat, the three point calibration of the screen corners, source ref: offset
0x10077b80-0x10077bd7inBAM.dll 1.5-408 .textx10077b80-0x10077bd7, note: fopen_s with wb, fwrite, fclose. No read site exists. - what: BAM_debug.log, BAM_CRASH.log and OpenGLdbg.log, source ref: offset
0x1007a45binBAM.dll 1.5-408 .textx1007a45b, offset0x1007ae0ainBAM.dll 1.5-408 .text, offset0x100d4318-0x100d4391inBAM.dll 1.5-408 .text, note: The crash log is written from the fault handler installed at load time, the other two only when the matching switch is on the command line.
- what: cfg<table>.cfg and cfg<table>.seq, per table settings and camera sequences, source ref: offset
-
-
shipped but not loaded:
-
note: Present in a distribution with no code path that opens it
-
entries:
- what: zlib.dll in BAM-OpenVR.zip, source ref:
BAM.dll,renderingengine.dll and every plugin import directory, note: No shipped binary imports it and neither BAM.dll nor renderingengine.dll names it in any string. Both carry their own zlib. - what: License.txt, 3741 bytes, source ref:
bam-setup.exe payload, note: The zlib licence the loader source carries, copied into the install.
- what: zlib.dll in BAM-OpenVR.zip, source ref:
-
-
named but not obtainable:
-
note: A literal the code opens that no distribution can provide
-
entries:
- what: c:\games\ppmm.bin, source ref: offset
0x100cff69-0x100cffa5inBAM.dll 1.5-408 .textx100cff69-0x100cffa5, note: fopen_s with rb then fread, guarded by two globals and reached only after glGetFloatv has read the modelview and projection matrices. The path is absolute and points at a directory no install creates.
- what: c:\games\ppmm.bin, source ref: offset
-
-
platform components:
-
note: Named in import directories but supplied by Windows or by a Microsoft redistributable, so they are prerequisites rather than payload.
-
entries:
- what: MSVCP140.dll, VCRUNTIME140.dll, CONCRT140.dll and the api-ms-win-crt set, source ref:
BAM.dll,renderingengine.dll import directories, note: Visual C++ 2015 or later runtime. Neither distribution carries it. - what: MSVCR100.dll, MSVCR120.dll and MSVCP120.dll, source ref:
PostFX.dll,TrackIR.dll,DesktopKinect.dll,PinballHighScore.dll import directories, note: Visual C++ 2010 and 2013 runtimes, for the older plugins. - what: opengl32, glu32, dinput8, hid, avicap32, avifil32, msvfw32, d3d11, dxgi, source ref:
BAM.dll,renderingengine.dll,plugin import directories, note: Windows components.
- what: MSVCP140.dll, VCRUNTIME140.dll, CONCRT140.dll and the api-ms-win-crt set, source ref:
-
Next steps
Section titled “Next steps”- Get the files, for the setup in use
- Every system, and the files each one needs
- When a game does not start