Compare commits

...
Author SHA1 Message Date
phobos2077 c3552614aa Test feature for step back and shoot AI behavior
Qwen3.6-35B-A3B-Q4_K_L
2026-04-20 19:52:13 +02:00
phobos2077 a966e9a553 Fix potential issue when "master_patches" is an absolute path and move recursive mkdir into a helper function 2026-04-20 10:55:33 +02:00
phobos2077 6b0f1ae8c7 Migrate to local game#patch.cfg and skip fields with default values
- This was if some mod modifies/overwrites game.cfg later, only fields that user cares about will be loaded from user's override, and said mod is less likely to break
2026-04-19 18:11:44 +02:00
phobos2077 7ec6664dc3 Migrate to /data instead of CE dat 2026-04-19 17:40:26 +02:00
phobos2077 bd6a8f7e60 Minor review comment fixes 2026-04-19 17:19:34 +02:00
phobos2077 ae2c70be44 Removed option to disable cities limit fix 2026-04-19 17:13:25 +02:00
github-actions[bot] 1d4cc9b5e6 chore: auto-format with clang-format 2026-04-18 14:37:56 +00:00
Vlad K 1d72544cbb Automatic migration from ddraw.ini 2026-04-18 16:37:26 +02:00
Vlad K dd60d8795f Move game.cfg to new base mod 2026-04-18 12:19:18 +02:00
Vlad K 765574056c Add hard-coded foce_base.dat to have reliable location to load CE-provided content from 2026-04-18 12:18:36 +02:00
github-actions[bot] 6d9deca69d chore: auto-format with clang-format 2026-04-18 09:22:08 +00:00
Vlad K 2545e0980d Update docs 2026-04-18 11:08:32 +02:00
Vlad K f321591610 Migrate character and text related settings 2026-04-18 10:53:50 +02:00
Vlad K 4062dee345 Moved remaining worldmap settings to game.cfg 2026-04-18 10:37:35 +02:00
Vlad K 0bd2707c3f Various fixes from self review 2026-04-18 01:48:36 +02:00
Vlad K bd62603293 Moved non-file related settings from ddraw.ini to game.cfg 2026-04-18 01:08:05 +02:00
Vlad K fdd311e9c4 Add basic content config structure 2026-04-17 23:29:16 +02:00
Vlad Kandgithub-actions[bot] 5188ebd4f4 Simplify settings registry with macros (#386)
* Simplify settings registry with macros

* chore: auto-format with clang-format

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-17 22:44:23 +02:00
Mike Klaas 1a77361231 Implement HOOK_MOUSECLICK (#383)
Tested in all major UI modes (worldmap, inven, dialog, pipboy, &c.)
2026-04-17 08:54:22 -07:00
Mike Klaas ed2db51afd Implement gdialog_get_barter_mod (#385)
* Implement `gdialog_get_barter_mod`

Used by Et tu
2026-04-17 08:37:34 -07:00
Vlad K 53ff2293a1 Feature/sfall config move prefs (#381)
* ddraw.ini: moved all settings considered "player preference" into fallout2.cfg

* Update docs and config files

* Simplify docs

* Review fixes
2026-04-17 09:26:39 +00:00
Mike Klaas c4e722612f Match obj_is_openable semantics with Sfall (#382)
* Match `obj_is_openable` semantic with Sfall

Sfall implements this in the opcode: https://github.com/sfall-team/sfall/blob/master/sfall/FalloutEngine/EngineUtils.cpp#L232

This is also called in `objectOpenClose` to early exit when not openable, so I think it make sense to include in the engine-level check

* typo
2026-04-16 21:09:10 -07:00
Mike Klaas 8f3ccca71b Implement several trivial opcodes (#380)
* Implement several trivial opcodes

* get/set_combat_free_move
* item_weight
* obj_is_openable
* get/set_critter_current_ap
2026-04-16 09:20:56 -07:00
Mike Klaas 386b6c26c7 Implement HOOK_CALCAPCOST (#376)
* Implement HOOK_CALCAPCOST

An opcode a day keeps the stimpak away.

https://sfall-team.github.io/sfall/hook-types/#calcapcost

Same as Sfall, but also calls the hook on game load to display the correct AP cost on load.

Also fix a minor bug where the attack mode of the current hand sometimes leaked when loading a save game.  Normally attack mode (burst/reload/&c) isn't saved.  But if you are in aimed mode (say), and load a game with the same weapon equipped, the attack mode will persist.  This is pretty weird, so changed it to always be in the default mode when loading a save.

* test script

* PR comments

* doc tweaks
2026-04-16 05:18:12 +00:00
Vlad KandCopilot 51b0c3c8c0 Feature/cfg keep comments and order (#375)
* Retain key&sections comments when overwriting fallout2.cfg

- Vibe coded with human review and testing

* Fix anim_speed key name

* Revert comment removal by Gemini

* Handle final remove/rename failures

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix edge case when filePath is near MAX_PATH

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove dead weight

* Vibe coded bug fixes and new write flag

* Comment for config flags

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-15 21:14:00 +00:00
Mike Klaas 00a05e5279 get_outline and get_light_level (#379)
These are trivial.  I have a testing script but I don't think it's worth checking in.

(Used by FO2Tweaks)
2026-04-15 12:52:29 -07:00
Mike Klaas a65a426e27 Implement HOOK_WITHINPERCEPTION (#374)
* Implement HOOK_WITHIN_PERCEPTION

Another Et tu hook
2026-04-14 16:55:13 +00:00
Mike Klaasandgithub-actions[bot] a697f0b868 Fix garbled splash screen when SkipOpeningMovies=1 (#372)
* Fix garbled splash screen when `SkipOpeningMovies=1`

If the splash screen is shown but movies are skipped, the main menu palette is applied to the splash screen for a split second, showing garbled colours.  This doesn't happen with movies since they clear the screen.

Fix is to force a black screen clear beforing fading in the main menu

* simplify

* chore: auto-format with clang-format

* Restore palette before load-list error dialog

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-13 20:17:15 -07:00
Vlad Kandgithub-actions[bot] 9e8eaa13f5 Settings registry refactoring (#371)
* Refactor settings save/load to use registry pattern

- Some AI work, needs review

* Fix player_speedup having incorrect cfg key, move config file names to cc, clang format code

* Missing for previous commit

* Remove config key aliases used only for registry, remove unused prefence names, some code cleanup after AI

* Move path normalization to settings.cc, skip mapper config outside of mapper,

* Simplify code by using template constructors

* Move ui_anim_speed to ui section

* chore: auto-format with clang-format

* Build fix attempt

* Format

* Compile fix attempt 2

* chore: auto-format with clang-format

* Code review fixes

* Init debug mode ASAP, log setting clamping, remove unused sound settings

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-14 00:43:41 +02:00
Vlad KandCopilot 14839db4f9 Set DPI Awareness hint on windows (#370)
* Set DPI Awareness hint on windows

* Windows specific hint must be used only on WIN32

* Check for SDL_HINT_WINDOWS_DPI_AWARENESS

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-13 00:41:33 +02:00
Mike Klaas e1f5f83ebd Fix strange mouse behaviour in windowed mode when scale>=2 (#369)
* Fix windowed mouse coordinate handling
2026-04-12 10:52:51 -07:00
Vlad K 6e6f82414e Update readme to reflect f2_res.ini migration, add fallout2.cfg to files (#368)
* Update readme to reflect f2_res.ini migration, add fallout2.cfg to files

* Better defaults, valid example resolution, explain scaling
2026-04-11 22:37:22 +02:00
Mike Klaas 6f0f68d5aa Fix crash when using op_pickup with global scripts (#366)
1 isn't valid return value here. 0 is success, -1 is failure.  Verified against original assembly and dozens of other examples.
2026-04-10 07:53:46 -07:00
Mike Klaas 141c67575f Update PR template to remove formatting instructions (#365)
(Auto-format takes care of this)
2026-04-10 07:53:30 -07:00
Mike Klaas a7a7f0b63c Implement sfall signal_close_game (#364)
* Implement sfall `signal_close_game`

Used by Et tu, but might be useful for LLMs too to quit the game after running a test case.

Also added enum for `_user_wants_to_quit`, and did minor reformatting of SFALL_COMPATIBILITY.md
2026-04-10 05:07:43 +00:00
f1d436b144 Move all HRP settings to fallout2.cfg (#345)
* Moved f2_res.ini settings into regular game config

* Rename resolution fields

* chore: auto-format with clang-format

* Code review fixes

* chore: auto-format with clang-format

* One-time migration of f2_res.ini to fallout2.cfg (#350)

* One-time migration of f2_res.ini to fallout2.cfg

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mike Klaas <mike.klaas@gmail.com>
2026-04-10 00:40:33 +02:00
Mike Klaas 5939e41da6 Fix crash when global scripts are called reentrantly (#363)
Saw a crash while testing gl_ShowLootWeight.  The issue was that the script uses `repeat(1)`, and we tried to spawn it again while it was running.

The fix is to check if the program is already running, using the same logic as the game does when running scripts.

This doesn't happen with Sfall since its global script implementation is more integrated with the interpreter.  This does point to likely other subtle differences that might matter.
2026-04-09 08:14:03 -07:00
Mike Klaas 7079da6e90 Sfall-style Context for metarules (#354) 2026-04-08 21:15:15 -07:00
Mike Klaas 1680e885f2 Implement obj_is_carrying_obj Sfall opcode (#362)
Note: does not include the sfall fix to fix stack counts
2026-04-08 20:52:02 -07:00
Mike Klaas b31737d4f7 Update vendored Android SDL library (#358)
* Add Android SDL Java sync guard

* Harden Android SDL Java sync guard

* Sync Android SDL Java bindings

* update to sdk24 (2016) to support newer SDL
2026-04-08 11:57:52 -07:00
Mike Klaas 270f974926 Deobfuscation pass for interpreter.cc/h (#360)
* Deobfuscation pass for interpreter.cc/h

Almost entirely mechanical renaming, with very minor semantic changes:
* changed a couple globals to `static` which were only in this file
* changed a couple bool-like ints to bool
* started adding `const` to local vars
2026-04-07 23:08:20 -07:00
Mike Klaas 92cc37560a Fix list_as_array(LIST_CRITTERS) returning objects with pid=-1 (#359)
* Fix `list_as_array(LIST_CRITTERS)` returning objects with pid=-1

When using gl_highlighting, I saw:

```
2026-04-01 12:42:52.824 Fallout II Community Edition[34437:20111056] INFO: Current script: scripts\gl_highlighting.int, procedure ToggleHighlight
2026-04-01 12:42:52.950 Fallout II Community Edition[34437:20111056] INFO: Script Error: scripts\gl_highlighting.int: op_critter_state: obj is NULL
2026-04-01 12:42:52.950 Fallout II Community Edition[34437:20111056] INFO:
Error during execution: get_proto_data: bad proto -1
```

We missed checking that pidType < -1, so we indexed kObjectTypeToListType[-1] which is UB.  Either we were lucky and this OOB memory matched, or the compiler was getting cheeky.  This fixes the bug and stops the error.

* PR feedback
2026-04-06 22:24:49 -07:00
Mike Klaas 3abdbcb53b Fix Text Delay not saving in options (#357)
The original clamps to [1, 6], so this was just wrong.

Fixes #224
2026-04-05 08:59:30 -07:00
Mike Klaas b7cacdc6da Implement HOOK_COMBATTURN (#352) 2026-04-03 23:25:33 -07:00
Mike Klaas a98d9d6c26 Implement HOOK_INVENTORYMOVE (#351) 2026-04-03 22:08:25 -07:00
Mike Klaas 0a64cf4f6b Partially deobfuscate worldmap.cc (#349)
I did this as part of looking into `WorldMapSlots=21` support.  I don't fully understand that one yet, but this semantics preserving cleanup is worth committing
2026-04-04 04:23:14 +00:00
Mike Klaas b97c9864aa Fix global script loading on non-Windows (#347)
* Fix global script loading on non-Windows

Previously, global scripts in .dats and in local FS didn't work due to path separator confusion.

Now:
 * Hardcode global script path to "scripts\gl*.int" (windows separator)
 * Use Windows fpattern matching inside of dFile (.dats, which always use windows separators)
 * Use \-paths when listing found global scripts

The awkward part is having to vendor a copy of fpattern to force it to use "windows mode".  It's possible that we could use this everywhere since windows allows / as separator, but that could cause bugs where we're using fpattern on the native FS.  For now keeping the dFile implementation separate makes sense.
2026-04-01 20:20:57 -07:00
Vlad Kandgithub-actions[bot] 8d0009aa45 Nested array expressions (#346)
* Nested array expressions

* chore: auto-format with clang-format

* Code review fixes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-31 20:18:38 +00:00
Vlad K 511d53a615 fix set_proto_data leftover value on stack in case of invalid args + use programPrintError (#344) 2026-03-31 17:03:50 +02:00
Mike Klaas f17dd19116 Fix parameter order in metarules set_flags and set_outline. (#341)
* Fix parameter order in metarules set_flags and set_outline.

Also fix missing return val in message_box error path
2026-03-30 08:35:35 -07:00
Mike Klaas c28c62727f Implement sfall animation opcodes and metarule (#326) 2026-03-30 08:24:57 -07:00
Mike Klaas b14f518714 Comment out hires_stencil debug logs (#339)
These are a bit too much when debugging other features.  Could make this controlled by a bool too if people prefer
2026-03-30 07:53:57 -07:00
Vlad K 6a0bed4433 Death Anim script hook + fall anim fix + related refactoring (#336)
* actions: refactor code around death anim selection

* add Death Anim hook from sfall

* AI review fixes

* Rename constants for force field PID/FID
2026-03-30 00:23:53 +02:00
Mike Klaas ce27eb55a1 Sfall compatibility tracker (#334)
The idea is that modders / contributors could track what is implemented, what is planned/unplanned, &c.  There's a risk that we won't keep it up to date, but I think it's a document that we'll need eventually.
2026-03-29 13:32:45 -07:00
Mike Klaas c240657d0d Fix two metarule argument popping order errors (#335)
* Fix two metarule argument popping order errors

Also, backfill all errorReturn and argument type validation for metarules
2026-03-29 13:26:34 -07:00
Vlad Kandgithub-actions[bot] 0a73abe67d Barter hook refactoring and Keypress hook repeat fix (#333)
* Barter hook refactor: weight compute in separate fn, names and comments for related vars, consistent value args

* Hook scripts: use initializer_list for defining args

* Keypress Hook: don't trigger on repeat, to match sfall

* chore: auto-format with clang-format

* Attempt to fix formatting after clang-format

* Don't use references for return values, for better readability

* chore: auto-format with clang-format

* Code review fixes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-29 13:57:30 +02:00
Vlad K 54228248ef Add barter hook from sfall (#331)
* Add barter hook from sfall

* Code review fixes
2026-03-28 10:43:47 +01:00
Mike Klaas 4eba423399 Use GameMode::getCurrentGameMode() instead of custom game mode detection (#328)
* Use `GameMode::getCurrentGameMode()` instead of custom game mode detection
2026-03-28 00:41:33 -07:00
Mike Klaas de98136699 Implement sfall tile/path opcodes (#330)
* Implementation of tile and path opcodes
2026-03-27 22:58:29 -07:00
Mike Klaas b27b0f03fc Fix get_ini_setting (#329)
Previously it was returning `0` if the key is missing from the ini file, but the spec is to return -1: https://sfall-team.github.io/sfall/ini-settings/#get_ini_setting

Note that if the key _exists_, but is the value is empty (`key=`), sfall returns `0`.
2026-03-26 07:51:00 -07:00
Mike Klaas 9d6f86424e Implement sfall add_extra_message_file (#327)
https://sfall-team.github.io/sfall/sfall-funcx-macros/#add_extra_msg_file

For now we're choosing to not support the 2-arg form.  We could return `-1` if the script tries to do this, but if so and it doesn't check for an error, that's likely worse than just crashing at this point.  It's essentially an unimplemented opcode.
2026-03-25 21:19:35 -07:00
Mike Klaas bb65d8d32a sfall opcode refresh_pc_art (#324)
Needed for RPU
2026-03-24 05:30:08 +00:00
Mike Klaas c9139f762d Deobfuscate scripts.cc/h (#323)
* Deobfuscate `scripts.cc/h`

Mostly renaming, but also includes:
 * Some straightforward uninling
 * Function extraction of a pretty large chunk (elevators)
 * Simplification of the script loading loop

Tested manually
2026-03-22 04:25:46 +00:00
Mike Klaas beb3c537a4 Fix several compile warnings (#316)
* Fix several compile warnings

Main change is making display functions accept const char* instead of mutating their arguments.
2026-03-21 21:42:15 +00:00
NovaRain b71f1e7d18 Merge pull request #313 from NovaRain/wmenc_table_fix
Fix crash/glitched map when the encounter table has no available entries
2026-03-21 18:33:15 +08:00
Vlad K b7f2b32b92 Debug window size setting, start debug output earlier and log number of loaded mods (#321)
* Debug window size setting, start debug output earlier and log total number of mods loaded

* Code review fixes
2026-03-21 10:54:32 +01:00
Vlad K 75776e4b5b HOOK_COMBATDAMAGE (#322)
* HOOK_COMBATDAMAGE

* Fix compilation on 64bit systems

* Fix incorrect hit location var
2026-03-20 10:53:03 -07:00
Mike Klaas 5304823f8f Fix argument order in mapper: mapSetEnteringLocation (#315)
Mapper's call of this function uses the wrong order compared to all other uses

Fixes #294
2026-03-20 13:08:09 +01:00
Vlad K 5860ee2ffd Merge pull request #319 from fallout2-ce/feature/hook-ongamemodechange-rebase
Implement sfall HOOK_ONGAMEMODECHANGE
2026-03-20 11:23:44 +01:00
Mike Klaas 550e6f035a Implement sfall HOOK_ONGAMEMODECHANGE
Pretty straight forward one
2026-03-20 11:12:28 +01:00
Vlad Kandgithub-actions[bot] 26978dedc5 Hook scripts, related opcodes and some deobfuscation (#312)
* hooks: an empty cc and a list of hook types with useful comments

* Deobfuscate some script-related procedures and flags

* Script hooks WIP

* Interpreter: add programPrintError(), Program->procedureCount(), rename string-related functions

* ScriptHookCall refactoring and all basic hook script opcode implementation

* HOOK_KEYPRESS and first working hooks

* mf_obj_under_cursor + some test script

* HOOK_TOHIT

* chore: auto-format with clang-format

* Add hooks: useobj, useobjon

* chore: auto-format with clang-format

* opcode: get_sfall_args

* Code review fixes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 11:08:49 +01:00
Mike Klaas 47434c4038 Starting game_dialogc/h deobfuscation (#307) 2026-03-18 22:50:11 -07:00
NovaRain 23e9eab72d Fix crash/glitched map when the encounter table has no available entries (#311) 2026-03-19 09:13:43 +08:00
Vlad K ed23b0f502 Fix crash when trying to run missing combat_p_proc and start is not the first in the script (#310) 2026-03-17 07:38:04 +00:00
Vlad K f0404596d0 Add fallout2.cfg->preferences->ui_anim_speed setting (#305)
* Use ui_anim_speed for fading, dialog panel, combat panel, pipboy rest
2026-03-17 08:33:16 +01:00
Vasilii Rogin 72da5eb879 Merge pull request #308 from fallout2-ce/fix/tile-from-screen-xy-signature
Remove unused elevation from tileFromScreenXY call sites
2026-03-16 22:14:21 +02:00
Vasilii Rogin e0384a37b5 Fix tileFromScreenXY signature cleanup 2026-03-16 18:18:02 +02:00
Vasilii Rogin c8cf50540f Merge pull request #304 from fallout2-ce/remove_unused_elevation_from_tileToScreenXY
Remove unused elevation in tileToScreenXY
2026-03-16 18:09:29 +02:00
Mike KlaasandCopilot Autofix powered by AI ebcd124ba4 Add a few more proto extendedFlags names (#306)
* Add a few more proto extendedFlags

Added a few names based on the list in fallout-tools: https://github.com/rotators/fallout-tools/blob/4a54255f3403e90cff8a20e657df152cb2602a65/F2_ProtoManager/ProtoManager/SetFlagsForm.Designer.vb#L883

Follow up to https://github.com/fallout2-ce/fallout2-ce/pull/301

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-15 23:51:23 +00:00
Mike Klaas 07c55842b4 Enums for proto flags (#301) 2026-03-15 22:43:52 +00:00
Vasilii Rogin 7ad7c43ce6 Remove unused elevation in tileToScreenXY 2026-03-15 20:42:42 +02:00
Mike Klaas c352107b09 Dobfuscate region, game_sound, art (#300) 2026-03-14 22:05:30 -07:00
Mike Klaas b6bfcff9b3 Deobfuscate window_manager, inventory, string_parsers (#299)
Also fix bug in _adjust_fid
2026-03-14 04:45:16 +00:00
Mike Klaas 1df5841810 Update preferences window slider when +/- is pressed (#298)
* Update preferences window slider when +/- is pressed

* do not save brightness when in perferences window
2026-03-13 20:54:31 -07:00
Mike Klaas 98ff03c0b9 Deobfuscations of draw,endgame,interface,preferences (#297)
* Deobfuscations of draw,endgame,interface,preferences

This is _mostly_ mechanical renames.

There are a few other changes:
* Extracted two helper functions
* Added a couple constants that virtually eliminated "magic numbers" in a couple functions
* Switched one int -> bool
* Made sure interfaceGetCurrentHand() is compared against HAND_RIGHT/LEFT instead of treated as boolean

* comment dev by zero issues
2026-03-13 04:14:22 +00:00
Mike Klaas 404236c0cb Deobfuscate audio_file, character_selector, options, dictionary, map, elevator, movie.cc/h (#293)
* Debobfuscate audio_file, character_selector, options, and others

* dictionary, font_manager, nevs

* elevator, map, movie

* item, mp_proto, skill

* proto_instance

* proto, proto_types

* revert dictionary, step -> i

* PR feedback

* criticalChanceModifier -> skillBonus

* skillOrCritSuccessBonus
2026-03-09 05:14:20 +00:00
Mike Klaas 3cd817d4b5 Deobfuscate export,game_movie,random,select_file_list,widget and more (#292)
* Deobfuscate export,game_movie,random,select_file_list,widget

* add automap,cache,display_monitor,game_mouse,geometry,window_manager_pricate

* add static to forward-declared static functions for c++ tidiness
2026-03-01 09:23:04 -08:00
Mike Klaas e8d85dbdd8 Revert to original behaviour in window.cc window existence checks (#291)
revert to original behaviour in window.cc window existence checks

* flagging probably mistaken function
2026-02-28 16:39:56 -08:00
Mike Klaas 3633652884 Rename window* -> scriptWindow* (#288)
* Rename window* -> scriptWindow*

This disambiguates the function names from those in managed_window.cc (which also used window*)

Plus a few items of PR feedback from https://github.com/fallout2-ce/fallout2-ce/pull/286
2026-02-27 05:05:49 +00:00
Mike Klaas e86dce3266 more deobfuscation (#286)
Deobfuscation of several files that were close to complete. There are mechanical renames for the most part. A couple exceptions noted in the changeset
2026-02-22 21:55:37 -08:00
a738c38a81 Function renaming part 2 (#285)
* Rename functions with RE-based names for consistency with new scheme

* Rename sub_* that have equivalents in original source

sub_* names pulled from https://raw.githubusercontent.com/sfall-team/sfall/master/sfall/FalloutEngine/FunctionOffsets_def.h if possible

Per discussion in Discord, sticking with camelCase names

* build fix

* window*

* Rename several more window* functions, add explanatory comment

---------

Co-authored-by: phobos2077 <phobos2077@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vlad K <phobos2077@users.noreply.github.com>
2026-02-22 16:58:01 +00:00
Vlad Kandgithub-actions[bot] be4569315f Function naming consistency, part 1 (#284)
* Rename functions with RE-based names for consistency with new scheme

* chore: auto-format with clang-format

* Fix typo

* critterHealByHours - better comment

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-22 17:47:45 +01:00
Mike Klaas a2505f8412 Deobfuscate audio/critter/heap.cc (#282)
Mechanical renames only
2026-02-17 22:35:36 -08:00
Mike Klaas 018d3dd48b Deobfuscate datafile.cc/h (#281)
Also, removed unused functions from the .h file

This PR contains only mechanical renames
2026-02-17 22:35:05 -08:00
Vlad 41eafedf87 Fix release standard library used in debug config (#280)
* Fix release standard library used in debug config

* Github Actions: Update MSVC build tools version
2026-02-17 17:54:07 +01:00
Vasilii Rogin c914e62f44 Merge pull request #277 from ololoken/emscripten-mouse-touch
[emscripten] do not lock mouse; improve mobile browsers compatibility;
2026-02-17 10:23:20 +02:00
cambragol a478e24c8a Merge pull request #279 from fallout2-ce/context-menu-fix
Update game_mouse.cc to fix context menu
2026-01-31 09:19:39 +09:00
cambragol 2703af882c Update game_mouse.cc to fix context menu
Don't set mouse to new position, set it to the original click point.
2026-01-30 22:27:18 +09:00
Roman Turchin 36e8b90831 [emscripten] do not lock mouse; improve mobile browsers compatibility; 2026-01-27 13:24:20 +01:00
Vasilii Rogin 3249b7dc07 Merge pull request #276 from fallout2-ce/improvements_for_map_edge
Disable hi-res stencil if ignoreMapEdges is enabled
2026-01-25 10:37:23 +02:00
Vasilii Rogin f291f52a61 Merge pull request #275 from fallout2-ce/click_through_fix
Click through fix
2026-01-25 10:32:57 +02:00
Vasilii Rogin 4bc2ed5d0d Show message only once 2026-01-25 10:30:14 +02:00
Vasilii Rogin b6a522a065 Disable stencil on tile_hires_stencil_init 2026-01-25 10:28:40 +02:00
github-actions[bot] bbb01398ef chore: auto-format with clang-format 2026-01-20 18:11:36 +00:00
Vasilii Rogin fb5e1f9c07 Auto-disable stencil if gTileIgnoreMapEdges is enabled 2026-01-20 20:08:50 +02:00
Vasilii Rogin 625928265e Merge pull request #274 from JanSimek/ignore-map-edges
Ignore map edges
2026-01-20 20:03:56 +02:00
Jan Ĺ imek a6ccac2a58 Added IGNORE_MAP_EDGES configuration option to f2_res.ini 2026-01-19 19:23:50 +01:00
cambragol 19e72a5b6d Update inventory.cc
The block here prevents clicking triggering on window close.
2026-01-19 07:42:34 +09:00
cambragol 44f5477ee5 Update input.h
Define the global
2026-01-19 07:40:01 +09:00
cambragol 8d0587566f Update input.cc
Defined the global
2026-01-19 07:38:21 +09:00
cambragol 0ed3725124 Update game_mouse.cc
Adding block for mouse left mouse button up
2026-01-19 07:36:25 +09:00
Jan Ĺ imek 86787e2c97 correct SSL function names in comments 2026-01-18 21:46:20 +01:00
Vasilii Rogin f60b773ed4 Merge pull request #273 from fallout2-ce/add_cities_limit_fix_fallout2-ce
Add sfall CitiesLimitFix to fix Resurrection startup
2026-01-18 22:44:51 +02:00
Vasilii Rogin b6384ce8e9 Merge remote-tracking branch 'roginvs/add_cities_limit_fix' into add_cities_limit_fix_fallout2-ce 2026-01-18 20:11:20 +02:00
Vasilii Rogin 15aa1db286 Revert initialization order of gTownMapHotkeysFix 2026-01-18 20:09:17 +02:00
Vasilii Rogin 763169f33e Merge branch 'main' into add_cities_limit_fix 2026-01-18 19:57:07 +02:00
Vasilii Rogin 58b811f2ae Fix overlapping memory copy (#265) 2025-12-26 15:57:39 +02:00
Vasilii Rogin bfcfaa9540 Fix negative ammo for Mega Power Fist (#267)
* Add non-negative check for ammo

* Rename variables
2025-12-23 20:09:03 +02:00
Vasilii Rogin a478bad7fa Merge pull request #260 from fallout2-ce/allow_lower_mouse_sensivity
Allow lower mouse sensitivity
2025-09-11 18:21:15 +03:00
Vasilii Rogin 9a3ec752dd Fix typo 2025-09-09 20:45:03 +03:00
Vasilii Rogin f940766379 Allow 0.25-2.5 for mouse sensivity 2025-09-09 17:46:42 +03:00
Vasilii Rogin 87e1d1f11b Merge pull request #256 from fallout2-ce/ci_add_wait_for_deployment
Mark CI as done when preview is actually deployed
2025-09-08 08:04:44 +03:00
Vasilii Rogin 5d17e0ef89 Update deployment status AFTER website is actually deployed 2025-09-07 13:05:33 +03:00
Vasilii Rogin 2bf08228c5 Add step to ensure that deployment went well 2025-09-07 12:46:33 +03:00
Mike Klaas 571b43410d Fix crash during encounter (#254)
Initial report: https://github.com/BGforgeNet/Fallout2_Restoration_Project/issues/350, first fixed in sfall.

h/t @NovaRain for the fix!

Fixes #253
2025-08-26 08:36:43 -07:00
APAmk2 f0e6002df9 Merge pull request #252. SFall callbacks implementation. 2025-08-18 21:07:58 +04:00
APAMk2 d593c481f2 Clang-format fix & proper variable name 2025-08-18 21:01:26 +04:00
APAMk2 76f3d82679 Clang-format fixes 2025-08-17 23:26:49 +04:00
APAMk2 0e1270a606 Renamed sfall_behaviours to sfall_callbacks 2025-08-17 23:17:00 +04:00
APAMk2 55a32a00ab SFall callbacks implementation (EXPERIMENTAL) 2025-08-17 20:55:09 +04:00
Vasilii Rogin 7b9b545baa Merge pull request #251 from fallout2-ce/minor-more-deobfus
Yet more deobfuscation
2025-08-17 18:42:10 +03:00
Mike Klaas a96edd9f0c one more 2025-08-17 07:36:45 -07:00
Mike Klaas 55c528f346 fixes 2025-08-17 07:22:45 -07:00
Mike Klaas 5c28dc798f Yet more deobfuscation
Focusing on the files that are "almost" fully deobfuscated.  As usual, no semantic changes
2025-08-17 07:17:45 -07:00
APAmk2 7ef6943588 Merge pull request #249 from APAmk2/png-screenshots
PNG Screenshots implementation
2025-08-17 18:07:41 +04:00
Mike Klaas 40bbd6c02a Minor deobfuscation of function parameters (#250)
No semantic changes, just chipping away at removing placeholder function parameters
2025-08-17 06:56:21 -07:00
APAMk2 45c491c11f Added lodepng license file 2025-08-17 17:02:50 +04:00
APAMk2 18c05d438e Fixed clang-format error
Want to believe
2025-08-17 16:58:51 +04:00
APAMk2 c3a501a644 Changed PngScreenshots option to ScreenshotsFormat for new formats in future 2025-08-17 16:54:09 +04:00
APAMk2 2767a399c5 Moved lodepng to third_party folder 2025-08-17 16:39:31 +04:00
APAMk2 1237d8561d Use std::vector, instead of c-style array 2025-08-17 16:07:04 +04:00
APAMk2 89b6812711 Typo fix 2025-08-17 15:50:51 +04:00
APAMk2 339146c5b3 PNG Screenshots implementation 2025-08-17 15:30:06 +04:00
Vasilii Rogin 3949c5d7c1 Merge pull request #248 from fallout2-ce/use-precise-distance-for-walking
Use path length instead of tile distance for determining walk vs run
2025-08-17 10:16:49 +03:00
github-actions[bot] 84a64035e8 chore: auto-format with clang-format 2025-08-16 11:41:39 +00:00
Mike Klaas 164be5105a Use path length instead of tile distance for determining walk vs run
Fallout tries to be smart about walking vs running: if an object you're interacting with is "close" (<5 tiles), the PC will walk, otherwise, they'll run.

The problem with this is that the distance is calculated "as the crow flies" and doesn't take into account the path length.  So not rarely, your character will end up slowly walking a long distance to interact with an object.

This PR fixes that by using path length instead of tile distance.  This is slightly less performant, but extremely unlikely to ever be noticable.  Regardless, I used actual pathfinding only when the tile distance is short, so it is very unlikely to generate long paths (which, in any case, can happen just by trying to move to that tile).

To test, load the given save file.  Interacting with things on the other side of the wall usually triggers annoying walk behaviour.  E.g.:
* Looting the shelves on the other side of the wall
* Using Steal on the shelves / on an NPC
* Dropping an item on one side then picking it up from the other side.
2025-08-16 04:36:02 -07:00
Vasilii Rogin d532e4c398 Merge pull request #244 from fallout2-ce/fix_uncompressed_database_seek
Fix uncompressed database seek
2025-08-06 08:44:28 +03:00
Vasilii Rogin 950c12dbf7 Merge pull request #245 from fallout2-ce/fix_indexes_in_file_list_init
Fix off-by-one error in duplicates cleanup
2025-08-06 08:41:57 +03:00
Vasilii Rogin 2be9b7db65 Fix off-by-one error in duplicates cleanup 2025-08-05 22:43:27 +03:00
github-actions[bot] 138ce8be9b chore: auto-format with clang-format 2025-08-05 19:14:10 +00:00
Vasilii Rogin 96b9323a97 Add assertion about elements count 2025-08-05 22:09:27 +03:00
Vasilii Rogin 7c6d339e3d Do not initialize zlib on non-compressed files 2025-08-05 22:04:40 +03:00
Vasilii Rogin 2ec8240820 Merge pull request #239 from fallout2-ce/fix_gMapGlobalPointers_resize
Resize gMapGlobalPointers if inconsistency between .map and .gam file
2025-08-05 17:57:45 +03:00
Vasilii Rogin ca72573c14 Merge branch 'main' into fix_gMapGlobalPointers_resize 2025-08-05 09:47:15 +03:00
Vasilii Rogin 9974a23c1e Merge pull request #243 from fallout2-ce/fix-deployments-cleanup
Fix deployments cleanup
2025-08-05 08:39:47 +03:00
Vasilii Rogin cd6cce3f34 Update ci-delete-pr-preview.yml 2025-08-05 08:25:26 +03:00
Vasilii Rogin 361b9a0b30 Merge pull request #242 from fallout2-ce/try_to_use_github_deploy_field
Use deployment action instead of comment
2025-08-05 08:04:39 +03:00
Vasilii Rogin 7c7cb87f65 Merge pull request #238 from fallout2-ce/fix_memory_overlap_with_sound
Do not copy the same string, prevent sanitizer crash
2025-08-05 08:02:29 +03:00
Vasilii Rogin 20bcb2360c Fix env, add prune 2025-08-04 20:48:12 +03:00
Vasilii Rogin 75dbc98321 Add debug: true 2025-08-04 20:38:46 +03:00
Vasilii Rogin d792cfa32e add status 2025-08-04 20:38:16 +03:00
Vasilii Rogin e81a07dcaf Add ref, add deployment_id 2025-08-04 20:33:28 +03:00
Vasilii Rogin 0d78119680 Use deployment action instead of comment 2025-08-04 20:27:47 +03:00
github-actions[bot] 79d0fcfcaa chore: auto-format with clang-format 2025-08-04 16:57:36 +00:00
Vasilii Rogin 2d5e69d740 Resize gMapGlobalPointers if inconsistency between .map and .gam file 2025-08-04 19:51:31 +03:00
Vasilii Rogin b5cf3ee148 Do not copy the same string 2025-08-04 19:16:54 +03:00
Mike Klaas a571a985c6 Use FID_ROTATION macro to remove manual bit shifting (#236)
* Use `FID_ROTATION` macro to remove manual bit shifting

This is a mechanical change.

Note: this uncovered what I'm almost certain is a bug in the interpreter code.  I can fix it based on code inspection... this is how it's used everywhere else.  I'm not confident about reproducing it in game though, so open to thoughts on how to preceed here.

* Fix bugs
2025-07-30 21:27:01 -07:00
cambragol 6ccba74836 Merge pull request #230 from fallout2-ce/cambragol-patch-1
Full Transparency Fix
2025-07-23 11:22:25 +09:00
cambragol 30c3af01f5 Merge pull request #231 from fallout2-ce/cambragol-patch-2
Button Fix for Loadsave.cc
2025-07-23 11:22:01 +09:00
Vasilii Rogin fd25944a9e Merge pull request #235 from fallout2-ce/deobfus-iextra
Deobfuscate one function in interpreter_extra.cc
2025-07-22 21:01:48 +03:00
Vasilii Rogin 41c5d77f89 Merge branch 'main' into deobfus-iextra 2025-07-22 20:55:18 +03:00
cambragol 75513058a5 Merge branch 'main' into cambragol-patch-1 2025-07-23 02:07:04 +09:00
cambragol 0cf55eca75 Merge branch 'main' into cambragol-patch-2 2025-07-23 02:06:51 +09:00
Vasilii Rogin e6cbdd5466 Merge pull request #234 from fallout2-ce/test-cache-bust
Test ci cache busting
2025-07-22 18:48:47 +03:00
github-actions[bot] 90f634b285 chore: auto-format with clang-format 2025-07-22 05:23:02 +00:00
Mike Klaas 666ee6f41c Deobfuscate one function in interpreter_extra.cc
Introduces FID_WEAPON_CODE and FID_ROTATION.  In future PRs we can use these to eliminate a lot of inlined bit shifts
2025-07-21 22:21:06 -07:00
Mike Klaas 4342aefa5d Test ci cache busting 2025-07-21 21:55:00 -07:00
cambragol 7224c7d7fb Button Fix for Loadsave.cc
Fixes two missing button sounds for loadsave
2025-07-20 19:02:56 +09:00
cambragol dff7529707 Full Transparency Fix
Fix to restore full transparency. Without this, transparent windows leave a 'trail' within their frame.
2025-07-20 18:51:55 +09:00
Mike Klaas 2435b33480 Fix missing cursor on the right (mirrored) context menu (#227)
* Fix missing cursor on the right (mirrored) context menu

Fixes #226

* Additional deobfuscation + missing artUnlock)
2025-07-13 20:30:37 -07:00
Vasilii Rogin c4652d799a Merge pull request #220 from fallout2-ce/message-box
`message_box` metarule
2025-07-12 10:46:28 +03:00
Mike Klaas 5140b00ccf Implement show/hide_iface_tag,is_iface_tag_active for vanilla tags (#217)
* Implement `show/hide_iface_tag,is_iface_tag_active` for vanilla tags

This is all that is used by RPU (absent partycontrol mod)
2025-07-10 21:39:28 -07:00
Vasilii Rogin f1ba068d05 Merge pull request #198 from fallout2-ce/add_sfall_metarule_exists_metarule
Add opcode_exists metarule
2025-07-10 19:44:59 +03:00
Mike Klaas 01db7078c7 Decrypt some of tile.cc/h (#211)
Mostly functional changes, but did un-inline one function that Alex indicated likely should be uninlined.
2025-07-10 19:34:18 +03:00
Mike Klaas 64fd857da6 Update README.md for clearer OS X instructions (#223) 2025-06-29 20:47:48 -03:00
cambragol 555652d9c3 Merge pull request #216 from fallout2-ce/window-transparent
Window transparent
2025-06-25 16:11:02 +09:00
cambragol 8c35203b7d Merge branch 'main' into window-transparent 2025-06-24 17:33:06 +09:00
cambragol 0303a00299 Merge pull request #219 from fallout2-ce/trade-and-barter-glitch-fix
Trade/Barter background fix
2025-06-24 14:48:16 +09:00
cambragol dd16e374ee Update main.cc
fixed spelling typo
2025-06-24 14:40:27 +09:00
cambragol ce4495589b Update window_manager.cc
removed unneeded comments
2025-06-24 14:39:36 +09:00
github-actions[bot] af350914ef chore: auto-format with clang-format 2025-06-24 05:14:13 +00:00
Mike Klaas 8dd2afc4fa message_box metarule
This is used by Et Tu and RPU.

Also: some decyption of the underlying dialog box code
2025-06-23 22:11:51 -07:00
github-actions[bot] 240aa8a212 chore: auto-format with clang-format 2025-06-23 22:14:36 +00:00
cambragol c58b5eac1d Update window_manager.cc
Removed unneeded if/else switch.
2025-06-24 07:14:09 +09:00
cambragol 0bd8a76b05 Update inventory.cc
Fix background blits positions for moved inventory items
2025-06-23 22:13:23 +09:00
cambragol 853266b380 Merge branch 'main' into window-transparent 2025-06-23 20:55:44 +09:00
Mike Klaas 0adc9c9e77 Prevent pop-in by drawing city circles/names to temp buffer (#178)
* Draw city/name to a temp buffer to prevent pop-in
2025-06-22 22:48:08 -07:00
github-actions[bot] 150e734955 chore: auto-format with clang-format 2025-06-23 05:27:35 +00:00
cambragol d0ba0151d1 Update window_manager.cc
initialised _buffering as false, and put the switch to true in the if statement for the flag from the game init.
2025-06-23 14:27:07 +09:00
cambragol 67c70661a6 Update window_manager.cc
made _buffering conditional on the gameInitWithOptions flag for allocating _screen_buffer
2025-06-22 12:56:20 +09:00
cambragol 9c4efeb59d Merge branch 'main' into window-transparent 2025-06-22 11:18:20 +09:00
cambragol 8bd87be687 Update window_manager.cc
removed unused bool
2025-06-21 13:51:54 +09:00
cambragol 8101c78e78 Update window_manager.cc
cleaning up from testing code
2025-06-21 13:46:20 +09:00
cambragol 9b5737a14e Update automap.cc
Added WINDOW_TRANSPARENT | WINDOW_DRAGGABLE_BY_BACKGROUND temporarily for testing. The automap window default texture has transparency built in.
2025-06-21 11:31:58 +09:00
cambragol 3d4c073856 Update window_manager.cc
Set _buffering to true, add refresh for transparent windows
2025-06-21 10:19:33 +09:00
cambragol f868ac0e1a Update main.cc
Change game ini options to turn on _screen_buffer allocation
2025-06-21 10:09:19 +09:00
github-actions[bot] cd6ca76988 chore: auto-format with clang-format 2025-06-07 15:27:27 +00:00
Vasilii Rogin 5d3cbd567a Add test for OP_WRITE_INT opcode 2025-06-07 18:24:56 +03:00
Vasilii Rogin 70ef1d4009 Add opcode_exists metarule 2025-06-07 18:21:50 +03:00
Vasilii Rogin 3acf0ac6c4 Add assert for opcode_exists 2025-06-07 18:12:43 +03:00
Vasilii Rogin a73c336ead Add tests for metarule_exist/opcode_exists 2025-06-07 18:08:47 +03:00
Vasilii Rogin d46aea53bd Add initial test 2025-06-07 17:59:18 +03:00
Vasilii Rogin 41a7c97e69 Show warning if cities amount differs 2024-06-04 20:56:42 +03:00
Vasilii Rogin 2ca921c525 Revert "Remove cities amount check on game load"
This reverts commit e676089f83.
2024-06-04 20:50:03 +03:00
Vasilii Rogin e676089f83 Remove cities amount check on game load 2024-06-04 19:43:37 +03:00
Vasilii Rogin e119aa4c4d Use cities limit patch by default 2024-04-19 12:55:51 +03:00
Vasilii Rogin ea66287551 Load gCitiesLimitFix state before it is used 2024-04-18 23:23:41 +03:00
Vasilii Rogin db07e95f5b Use gCitiesLimitFix variable 2024-04-18 23:10:56 +03:00
Vasilii Rogin acd0413626 Check that save file have the same amount of cities 2024-04-18 23:02:22 +03:00
Vasilii Rogin 196ad2267f Fix formatting 2024-04-18 22:59:24 +03:00
Vasilii Rogin 22a864a0c9 Ignore cities count if CitiesLimitFix is enabled 2024-04-18 22:55:17 +03:00
Vasilii Rogin 252d7fe83e Add CitiesLimitFix into sFall config with default=true 2024-04-18 22:51:45 +03:00
229 changed files with 21795 additions and 5840 deletions
-10
View File
@@ -17,15 +17,5 @@
- *Preview builds are not available for pull requests from forked repositories.* To enable preview builds, submit the PR from a branch within this repository.
- *Formatting issues? You have two options:*
1. **Fix formatting automatically** using the following Docker command: *(If you're using Windows, remove `--user $(id -u):$(id -g)`)*
```bash
docker run --rm \
-v $(pwd):/app --workdir /app \
--user $(id -u):$(id -g) silkeh/clang:18 \
bash -c 'find src -type f -name \*.cc -o -name \*.h | xargs clang-format -i'
```
2. **Skip formatting check** by adding the `skip-formatting` label to this PR.
--->
+46 -5
View File
@@ -14,6 +14,16 @@ jobs:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: start deployment
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: bobheadxi/deployments@v1
id: deployment
with:
ref: ${{ github.event.pull_request.head.sha }}
step: start
debug: true
env: preview-${{ github.event.pull_request.number }}
- name: Clone
uses: actions/checkout@v4
@@ -76,6 +86,10 @@ jobs:
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
F2_GAME_VERSION: Game=${{github.event.pull_request.head.sha || github.sha }}
- name: Place hash file
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
run: echo "$GITHUB_SHA" > fallout2-ce-ems/dist/site_hash.txt
- name: Install rsync (required for the next step)
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
run: |
@@ -91,10 +105,37 @@ jobs:
clean: false
single-commit: true
- name: Comment preview URL on PR
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
- name: Check that site is deployed
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--body "🚀 WebAssembly PR Preview for ${{github.event.pull_request.head.sha || github.sha }} is available at: https://${{ github.repository_owner }}.github.io/fallout2-ce/PR-${{ github.event.pull_request.number }}/"
URL="$SITE_ORIGIN""$SITE_BASE""site_hash.txt"
echo "Expecting $GITHUB_SHA from $URL"
for i in `seq 1 80`; do
got="$(curl -fsSL --max-time 10 "$URL" | tr -d '\r\n' || true)"
if [ "$got" = "$GITHUB_SHA" ]; then
echo "âś… Match on attempt $i: ${got}"
exit 0
fi
echo "Received $got, waiting"
sleep 5
done
exit 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SITE_ORIGIN: https://${{ github.repository_owner }}.github.io
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
- name: Update deployment status
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: bobheadxi/deployments@v1
with:
step: finish
status: success
debug: true
env: ${{ steps.deployment.outputs.env }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
ref: ${{ github.event.pull_request.head.sha }}
env_url: https://${{ github.repository_owner }}.github.io/fallout2-ce/PR-${{ github.event.pull_request.number }}/
+8 -8
View File
@@ -87,7 +87,7 @@ jobs:
uses: actions/cache@v4
with:
path: os/android/app/.cxx
key: android-cmake-v100
key: android-cmake-v101
- name: Setup signing config
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
@@ -128,7 +128,7 @@ jobs:
uses: actions/cache@v4
with:
path: out
key: ios-cmake-v100
key: ios-cmake-v101
- name: Configure
run: |
@@ -183,7 +183,7 @@ jobs:
uses: actions/cache@v4
with:
path: out
key: linux-${{ matrix.arch }}-cmake-v100
key: linux-${{ matrix.arch }}-cmake-v101
- name: Configure
run: |
@@ -288,7 +288,7 @@ jobs:
uses: actions/cache@v4
with:
path: out
key: macos-cmake-v100
key: macos-cmake-v101
- name: Configure
run: |
@@ -328,16 +328,16 @@ jobs:
- name: Clone
uses: actions/checkout@v4
- name: Install Visual Studio 2019 Build Tools with v141_xp
- name: Install Visual Studio 2022 Build Tools with v141_xp
shell: cmd
run: |
choco install visualstudio2019buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
choco install visualstudio2022buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
- name: Cache cmake build
uses: actions/cache@v4
with:
path: out
key: windows-${{ matrix.arch }}-cmake-v100
key: windows-${{ matrix.arch }}-cmake-v102
- name: Configure
shell: cmd
@@ -432,4 +432,4 @@ jobs:
tag_name: continious
draft: false
prerelease: true
name: Fallout2-CE Continuous Build
name: Fallout2-CE Continuous Build
+10 -1
View File
@@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
deployments: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
@@ -43,4 +44,12 @@ jobs:
else
git commit --amend -m "đźš® Remove preview for closed PR #${{ github.event.pull_request.number }}"
git push --force
fi
fi
- name: mark environment as deactivated
uses: bobheadxi/deployments@v1
with:
step: deactivate-env
env: preview-${{ github.event.pull_request.number }}
desc: Environment was pruned
debug: true
+25
View File
@@ -0,0 +1,25 @@
## Further Reading
- Refer to the project README for overall architecture.
## Working With Code
- Only search for code and symbols inside the `src/` directory.
- NEVER search entire code base for certain file or symbol when it's location isn't known, ask first.
- NEVER read entire files unless absolutely necessary for task. Use MCP search instead.
- Prefer CLion MCP for searching code and basic refactoring over raw text tools such as grep.
- Test changes by compiling (separate cc file for small local changes, or via CLion build_project MCP for big changes).
- If game run test is request by prompt, start the game from C:\Games\Fallout2\@CE folder. It always contains last built executable, config file and game assets for full testing.
## Language Standard
- The project targets C++17 (`CMAKE_CXX_STANDARD 17` in `CMakeLists.txt`).
- Prefer C++17 library APIs and semantics when they simplify code. For example, `std::string::data()` is mutable in C++17.
- static global variable need no prefix. exported globals get g*.
- generally prefer camelCase
## Project Structure
- `src/`: All core game logic and engine implementation.
- `third_party/`: Vendored dependencies (zlib, SDL2, etc.).
- `os/`: Platform-specific assets and configuration (icons, plists, etc.).
- `cmake/`: Custom CMake scripts.
- `files/`: Default configuration files and data assets.
- `sfall_testing/`: SSL scripts for testing Sfall-related functionality.
+17 -1
View File
@@ -62,6 +62,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
"src/combat.h"
"src/config.cc"
"src/config.h"
"src/content_config.cc"
"src/content_config.h"
"src/credits.cc"
"src/credits.h"
"src/critter.cc"
@@ -102,6 +104,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
"src/font_manager.h"
"src/game_config.cc"
"src/game_config.h"
"src/game_config_migration.cc"
"src/game_config_migration.h"
"src/game_dialog.cc"
"src/game_dialog.h"
"src/game_memory.cc"
@@ -172,6 +176,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
"src/obj_types.h"
"src/object.cc"
"src/object.h"
"src/opcode_context.cc"
"src/opcode_context.h"
"src/options.cc"
"src/options.h"
"src/palette.cc"
@@ -286,13 +292,21 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
"src/sfall_metarules.h"
"src/sfall_opcodes.cc"
"src/sfall_opcodes.h"
"src/sfall_script_hooks.cc"
"src/sfall_arrays.cc"
"src/sfall_arrays.h"
"src/sfall_animation.cc"
"src/sfall_animation.h"
"src/sfall_callbacks.cc"
"src/sfall_callbacks.h"
"src/touch.cc"
"src/touch.h"
"src/scan_unimplemented.cc"
"third_party/lodepng/lodepng.cpp"
)
target_include_directories(${EXECUTABLE_NAME} PUBLIC "third_party/lodepng")
if(IOS)
target_sources(${EXECUTABLE_NAME} PUBLIC
"src/platform/ios/paths.h"
@@ -313,7 +327,8 @@ endif()
if(WIN32)
target_link_libraries(${EXECUTABLE_NAME}
winmm
libcpmt
debug libcpmtd
optimized libcpmt
)
endif()
@@ -425,6 +440,7 @@ endif()
add_subdirectory("third_party/fpattern")
target_link_libraries(${EXECUTABLE_NAME} fpattern::fpattern)
target_link_libraries(${EXECUTABLE_NAME} fpattern_windows::fpattern_windows)
target_link_libraries(${EXECUTABLE_NAME} ${ZLIB_LIBRARIES})
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${ZLIB_INCLUDE_DIRS})
+2 -2
View File
@@ -28,7 +28,7 @@
"inherits": [
"windows-base"
],
"generator": "Visual Studio 16 2019",
"generator": "Visual Studio 17 2022",
"architecture": "Win32",
"cacheVariables": {
"CMAKE_GENERATOR_TOOLSET": "v141_xp",
@@ -42,7 +42,7 @@
"inherits": [
"windows-base"
],
"generator": "Visual Studio 16 2019",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"cacheVariables": {
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>"
+20
View File
@@ -0,0 +1,20 @@
# Contributing
This file is currently a shell to be filled in over time. For now, it only captures project-specific maintenance notes that are easy to miss.
## Updating SDL
SDL is pinned for native builds in `third_party/sdl2/CMakeLists.txt`. Right now, Android also relies on checked-in Java bindings in `os/android/app/src/main/java/org/libsdl/app`, and those bindings must match the SDL version fetched by CMake.
When updating SDL:
1. Update the SDL tag in `third_party/sdl2/CMakeLists.txt`.
2. Run an Android build once so Gradle/CMake fetch the new SDL source tree.
3. Copy the Android Java bindings from the fetched SDL checkout into `os/android/app/src/main/java/org/libsdl/app`.
Source path pattern:
`os/android/app/.cxx/<Variant>/<Hash>/arm64-v8a/_deps/sdl2-src/android-project/app/src/main/java/org/libsdl/app`
4. Rebuild Android and confirm the SDL sync guard passes.
The Android build contains a guard in `os/android/app/build.gradle` that fails if the checked-in Java bindings drift from the fetched native SDL source.
This is a hack, not a good long-term setup. The Java bindings are still duplicated in the repo instead of being sourced from the same SDL tree as the native build. That should be improved so Android does not depend on a manual copy/sync step.
+21 -34
View File
@@ -44,7 +44,7 @@ $ sudo apt install libsdl2-2.0-0
- Alternatively you can use Fallout 2 from Macplay/The Omni Group as a base - you need to extract game assets from the original bundle. Mount CD/DMG, right click `Fallout 2` -> `Show Package Contents`, navigate to `Contents/Resources`. Copy `GameData` folder somewhere, for example `/Applications/Fallout2`.
- Or if you're a Terminal user and have Homebrew installed you can extract the needed files from the GoG installer:
- Or if you're a Terminal user and have Homebrew installed you can extract the needed files from the GoG installer. **Note**: You must use "Offline backup game installer", not the main game installer.
```console
$ brew install innoextract
@@ -84,7 +84,7 @@ $ mv app /Applications/Fallout2
### Browser
> **NOTE**: WebAssebly build with emscripten
> **NOTE**: WebAssembly build with emscripten
```
docker run --rm -v $(pwd):/src emscripten/emsdk:3.1.74 sh -c 'git config --global --add safe.directory "*" && mkdir -p build && cd build && emcmake cmake ../ -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/Emscripten.cmake && emmake make'
```
@@ -96,48 +96,35 @@ The main configuration file is `fallout2.cfg`. There are several important setti
The `sound` folder (with `music` folder inside) might be located either in `data` folder, or be in the Fallout folder. Update `music_path1` setting to match your hierarchy, usually it's `data/sound/music/` or `sound/music/`. Make sure it matches your path exactly (so it might be `SOUND/MUSIC/` if you've installed Fallout from CD). Music files themselves (with `ACM` extension) should be all uppercased, regardless of `sound` and `music` folders.
The second configuration file is `f2_res.ini`. Use it to change game window size, enable/disable fullscreen mode and configure IFACE settings (the control bar at the bottom of the game screen).
Additional settings for screen resolution, UI customization, and map options are now integrated into the main `fallout2.cfg` file (previously part of `f2_res.ini` from Mash's HRP). When Fallout 2 CE starts, if it detects an existing `f2_res.ini` file, it automatically migrates these settings into `fallout2.cfg`. After migration, `fallout2.cfg` becomes the single source of truth for this configuration.
The following settings can be configured in `fallout2.cfg` under the `[screen]` and `[ui]` sections:
```ini
[MAIN]
SCR_WIDTH=1280
SCR_HEIGHT=720
WINDOWED=1 ; 0 = fullscreen
SCALE_2X=1 ; 0 = original scale, 1 = 2x - requires increasing the minimum resolution from 640x480 to 1280x960.
[screen]
resolution_x=1600 ; actual game window size (screen resolution), in pixels
resolution_y=1080
windowed=1 ; 0 = fullscreen
scale=2 ; 1 = original scale, 2 = 2x scale, etc. (e.g. at scale 2 and screen resolution 1920x1080, in-game resolution will be 960x540, thus every pixel is twice as wide and tall)
[IFACE]
; if IFACE_BAR_MODE=0 - the bottom of the map view window sits at the top of the IFACE Bar.
; if IFACE_BAR_MODE=1 - the bottom of the map view window extends to the base of the screen and is overlapped by the IFACE Bar.
IFACE_BAR_MODE=0
;if IFACE_BAR_SIDE_ART=0 - Black, No Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=1 - Metal (grey) look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=2 - Leather look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=3-6 - Alternative Metal look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=7 - Alternative Leather look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=8 - Metal (brown) look Iface-bar side art used.
IFACE_BAR_SIDE_ART=2
;if IFACE_BAR_SIDES_ORI=0 - Iface-bar side graphics extend from the Iface-Bar to the Screen edges.
;if IFACE_BAR_SIDES_ORI=1 - Iface-bar side graphics extend from the Screen edges to the Iface-Bar.
IFACE_BAR_SIDES_ORI=0
;This will increase the width of the interface bar expanding the area used to display text.
;if IFACE_BAR_WIDTH=640 - Interface bar will remain at it's original width.
;if IFACE_BAR_WIDTH=800 - Interface bar will use 800pix wide asset from f2_res.dat.
;IFACE_BAR_WIDTH=640
[ui]
iface_bar_mode=0 ; 0 = interface bar below game window, 1 = interface bar overlaps game window
iface_bar_width=800 ; Width of interface bar (640 = original, 800 = extended)
iface_bar_side_art=2 ; Interface bar side art style (0=black, 1=metal grey, 2=leather, 3-8=alternative styles)
iface_bar_sides_ori=0 ; Side graphics orientation (0=extend from bar to edges, 1=extend from edges to bar)
splash_screen_size=1 ; Splash screen scaling (0=original size, 1=fit preserving aspect, 2=stretch to fill)
ignore_map_edges=0 ; Hi-res map scroll edges (0=enabled, 1=ignored)
```
Recommendations:
**Recommendations:**
- **Desktops**: Use any size you see fit.
- **Tablets**: Set these values to logical resolution of your device, for example iPad Pro 11 is 1668x2388 (pixels), but it's logical resolution is 834x1194 (points).
- **Mobile phones**: Set height to 480, calculate width according to your device screen (aspect) ratio, for example Samsung S21 is 20:9 device, so the width should be 480 * 20 / 9 = 1067.
In time this stuff will receive in-game interface, right now you have to do it manually. For a sample f2_res.ini configuration file, containing all currently working settings use this link: [f2_res.ini](https://raw.githubusercontent.com/fallout2-ce/fallout2-ce/refs/heads/mainmenu/files/f2_res.ini)
In time this stuff will receive in-game interface, right now you have to do it manually. To see all currently working fallout2.cfg settings, just run the game once and quit. It will be automatically updated with defaults for every supported setting.
*Note*: Use of the IFACE_BAR settings requires the `f2_res.dat` file, which contains graphical assets. Various versions are available, but one compatible with the above settings can be found here: [f2_res.dat](https://github.com/fallout2-ce/fallout2-ce/raw/refs/heads/main/files/f2_res.dat)
*Note*: use of the IFACE_BAR settings requires the f2_res.dat file, which contains graphical assets. Various versions are available, but one compatible with the above f2_res.ini be found here: [f2_res.dat](https://github.com/fallout2-ce/fallout2-ce/raw/refs/heads/mainmenu/files/f2_res.dat)
The third configuration file is `ddraw.ini` (part of Sfall). There are dozens of options that adjust or override engine behaviour and gameplay mechanics. This file is intended for modders and advanced users.
The second configuration file is `ddraw.ini` (part of Sfall). There are dozens of options that adjust or override engine behaviour and gameplay mechanics. This file is intended for modders and advanced users.
For a sample ddraw.ini configuration file, containing all currently working settings use this link: [ddraw.ini](https://raw.githubusercontent.com/fallout2-ce/fallout2-ce/refs/heads/main/files/ddraw.ini)
+128
View File
@@ -0,0 +1,128 @@
# Sfall Compatibility
This document tracks Fallout 2 CE compatibility with sfall. This is for modders who need to know which Sfall features work in CE.
For now, this covers opcodes/metarules, and hooks. In the future, it will include other ways of modifying the engine (like ini files), and other Sfall-specific behaviour.
## Settings (ddraw.ini → fallout2.cfg / game.cfg)
Settings previously read from `ddraw.ini` have been moved into standard CE config files.
Most settings that control game behavior (premade characters, extra message files, combat tweaks, worldmap, etc.) have been moved into [`<DAT>/config/game.cfg`](files/foce_base.dat/config/game.cfg), which is a content-mod config file intended to be overridden by mods. See that file for the full list with descriptions.
The following settings were moved into [`fallout2.cfg`](files/fallout2.cfg) instead:
| ddraw.ini section | ddraw.ini key | fallout2.cfg section | fallout2.cfg key |
| --- | --- | --- | --- |
| `Misc` | `SkipOpeningMovies` | `ui` | `skip_opening_movies` |
| `Misc` | `DisplayKarmaChanges` | `ui` | `display_karma_changes` |
| `Misc` | `DisplayBonusDamage` | `ui` | `display_bonus_damage` |
| `Misc` | `NumbersInDialogue` | `ui` | `numbers_in_dialogue` |
| `Misc` | `AutoQuickSave` | `ui` | `auto_quick_save` |
| `Main` | `EnableHighResolutionStencil` | `ui` | `enable_high_resolution_stencil` |
| `Misc` | `ConsoleOutputPath` | `debug` | `console_output_path` |
| `Misc` | `GaplessMusic` | `sound` | `gapless_music` |
| `Misc` | `ScreenshotsFormat` | `system` | `screenshots_format` |
| `Misc` | `UseWalkDistance` | `qol` | `use_walk_distance` |
| `Misc` | `AutoOpenDoors` | `qol` | `auto_open_doors` |
## Opcodes / Metarules
See [`https://sfall-team.github.io/sfall/`](https://sfall-team.github.io/sfall/) for documentation on specific functions.
| Group | Opcodes In Group | Compatibility | Notes |
| --- | --- | --- | --- |
| Direct memory access| read_byte,short,int,string<br>write_byte,short,int,string<br>call_offset_vX | đźš« | Not possible. Open an issue if you need functionality not covered by other opcodes. |
| Stats | get/set_pc_base_stat<br>get/set_pc_extra_stat<br>get/set_critter_base_stat<br>get/set_critter_extra_stat | âś… | CE uses engine stat helpers here instead of sfall's direct proto-field behavior, so derived-stat update behavior can differ. |
| Stats / Alter min/max | get/set_stat_min/max<br>set_pc_stat_min/max<br>set_npc_stat_min/max | not implemented | - |
| Skills | get/set_critter_skill_points<br>get/set_available_skill_points<br>set_skill_max<br>set_critter_skill_mod<br>set_base_skill_mod<br>mod_skill_points_per_level | not implemented | - |
| Graphics | graphics_funcs_available<br>force_graphics_refresh<br>get_screen_width<br>get_screen_height<br>set_palette | implemented: only get_screen_width, get_screen_height | - |
| Shaders | load_shader<br>free_shader<br>activate_shader<br>deactivate_shader<br>set/get_shader_* | đźš« | likely will not implement direct compatibility
| Perks and traits | set_perk_image<br>set_perk_*<br>set_pyromaniac_mod<br>apply_heaveho_fix<br>set_swiftlearner_mod<br>has/set_fake_perk<br>has/set_fake_trait<br>set_selectable_perk<br>set_perkbox_title<br>show/hide_real_perks<br>perk_add_mode<br>clear_selectable_perks<br>add/remove_trait<br>seq_perk_freq | not implemented | - |
| Virtual file system | fs_create<br>fs_copy<br>fs_find<br>fs_read/write_*<br>fs_delete<br>fs_size<br>fs_pos<br>fs_seek<br>fs_resize | đźš« | Open an issue if you have a use case for these |
| Combat / Knockback | set_weapon_knockback<br>set_target_knockback<br>set_attacker_knockback<br>remove_weapon_knockback<br>remove_target_knockback<br>remove_attacker_knockback | not implemented | - |
| Maps and encounters | in_world_map<br>force_encounter<br>force_encounter_with_flags<br>set_map_time_multi<br>get/set_map_enter_position<br>exec_map_update_scripts<br>get/set_terrain_name<br>set_town_title<br>get/set_can_rest_on_map<br>set_rest_heal_time<br>set_rest_mode<br>set_worldmap_heal_time | implemented: in_world_map, force_encounter, force_encounter_with_flags, set_map_time_multi | - |
| Maps and encounters / Worldmap | get_world_map_x/y_pos<br>set_world_map_pos | âś… | - |
| Audio | eax_available<br>set_eax_environment<br>play_sfall_sound<br>stop_sfall_sound | not implemented | *eax* opcodes will not be implemented |
| Combat / Weapons and ammo | get/set_weapon_ammo_pid<br>get/set_weapon_ammo_count | âś… | - |
| Sfall / Version | sfall_ver_major<br>sfall_ver_minor<br>sfall_ver_build | âś… | CE currently reports `4.3.4` |
| Utility / Math | log, exponent, round, sqrt, abs, sin, cos, tan, arctan, ceil, ^, floor2, div | âś… | - |
| Keyboard and mouse | key_pressed<br>tap_key<br>get_mouse_x/y<br>get_mouse_buttons | âś… | - |
| Lists | list_begin<br>list_next<br>list_end<br>list_as_array<br>party_member_list | âś… | - |
| Explosions | set_attack_explosion_pattern<br>set_attack_explosion_art<br>set_attack_explosion_radius<br>set_attack_is_explosion_fire<br>set_explosion_radius<br>set_dynamite_damage<br>set_plastic_damage<br>get_explosion_damage<br>set_explosion_max_targets<br>item_make_explosive | âś… except item_make_explosive | - |
| Animations | reg_anim_combat_check<br>reg_anim_destroy<br>reg_anim_animate_and_hide<br>reg_anim_light<br>reg_anim_change_fid<br>reg_anim_take_out<br>reg_anim_turn_towards<br>reg_anim_callback<br>reg_anim_animate_and_move | âś… except reg_anim_callback | - |
| Art and appearance | art_exists<br>refresh_pc_art<br>art_cache_clear<br>set_hero_race<br>set_hero_style | implemented: art_exists, refresh_pc_art, art_cache_clear | - |
| Tiles and paths | get_tile_fid<br>tile_under_cursor<br>tile_light<br>tile_get_objs<br>tile_refresh_display<br>obj_blocking_tile<br>tile_by_position<br>get_tile_ground_fid<br>get_tile_roof_fid<br>obj_blocking_line<br>path_find_to<br>objects_in_radius | âś… except objects_in_radius | - |
| Utility | sprintf<br>typeof<br>atoi<br>atof | âś… | - |
| Utility / Strings | string_split<br>substr<br>strlen<br>charcode<br>get_string_pointer<br>string_find<br>string_find_from<br>string_format<br>string_format_array<br>string_replace<br>string_to_case<br>string_compare | âś… | `get_string_pointer` is deprecated and intentionally omitted. |
| Interface / Tags | show_iface_tag<br>hide_iface_tag<br>is_iface_tag_active<br>set_iface_tag_text<br>add_iface_tag | âś… except set_iface_tag_text, add_iface_tag | CE only handles built-in interface tags here; custom tag creation/text is not supported yet. |
| Global variables | set_sfall_global<br>get_sfall_global_int<br>get_sfall_global_float | âś… except get_sfall_global_float | Current CE storage is int-backed; `set_sfall_global` stores integer values |
| Hooks / Hook functions | init_hook<br>get_sfall_arg<br>get_sfall_args<br>get_sfall_arg_at<br>set_sfall_return<br>set_sfall_arg<br>register_hook<br>register_hook_proc<br>register_hook_proc_spec | âś… | See below for implemented hooks. `init_hook` is deprecated and will not be implemented. register_hook_proc and register_hook_proc_spec both add hooks to the *end* of the hook list, instead of beginning and end, respectively. |
| Arrays / Array functions | create_array<br>temp_array<br>fix_array<br>get/set_array<br>resize_array<br>free_array<br>scan_array<br>len_array<br>save/load_array<br>array_key<br>arrayexpr | âś… except save_array, load_array | - |
| Perks and traits / NPC perks | set_fake_perk_npc<br>set_fake_trait_npc<br>set_selectable_perk_npc<br>has_fake_perk_npc<br>has_fake_trait_npc | not implemented | - |
| Global scripts / Global script functions | set_global_script_repeat<br>set_global_script_type<br>available_global_script_types | âś… except available_global_script_types | - |
| Combat | attack_is_aimed<br>block_combat<br>force_aimed_shots<br>disable_aimed_shots<br>get_attack_type<br>get/set_bodypart_hit_modifier<br>combat_data<br>get/set/reset_critical_table<br>get_last_target<br>get_last_attacker<br>set_critter_burst_disable<br>get/set_critter_current_ap<br>set_spray_settings<br>get/set_combat_free_move | implemented: get_attack_type, get_bodypart_hit_modifier, combat_data, set_bodypart_hit_modifier, get_critter_current_ap, set_critter_current_ap, get_combat_free_move, set_combat_free_move | - |
| Car | set_car_current_town<br>car_gas_amount<br>set_car_intface_art | implemented: all except set_car_intface_art | - |
| Interface / Windows and images | art_frame_data<br>interface_art_draw<br>interface_print<br>draw_image<br>draw_image_scaled<br>get_window_under_mouse<br>create_win<br>get_window_attribute<br>message_box<br>set_window_flag<br>win_fill_color<br>interface_overlay<br>dialog_message<br>get_text_width<br>hide_window<br>show_window<br>create_message_window | implemented: only message_box, get_text_width, show_window, create_message_window | - |
| Interface / Outline | outlined_object<br>get_outline<br>set_outline | âś… | - |
| Interface / Main interface | intface_is_hidden<br>intface_redraw<br>intface_hide<br>intface_show<br>set_quest_failure_value | implemented: only intface_redraw | `intface_redraw` only supports the zero-argument form; the optional-argument path is explicitly unimplemented. |
| Interface / Inventory | display_stats<br>inventory_redraw<br>critter_inven_obj2<br>get_current_inven_size<br>item_weight | implemented: critter_inven_obj2, item_weight | - |
| Interface / Cursor | get/set_cursor_mode | âś… | - |
| Locks | lock_is_jammed<br>unjam_lock<br>set_unjam_locks_time | not implemented | - |
| INI settings | get_ini_setting<br>get_ini_string<br>get_ini_section<br>get_ini_sections<br>get_ini_config<br>get_ini_config_db<br>set_ini_setting | âś… except get_ini_config, get_ini_config_db | `modified_ini` is intentionally omitted as deprecated. |
| Objects and scripts | set_self<br>set_dude_obj<br>real_dude_obj<br>remove_script<br>get/set_script<br>obj_is_carrying_obj<br>loot_obj<br>dialog_obj<br>obj_under_cursor<br>get/set_object_data<br>get/set_flags<br>set_unique_id<br>set_scr_name<br>obj_is_openable<br>get/set_proto_data<br>get_object_ai_data | implemented: set_self, get_script, obj_is_carrying_obj, loot_obj, dialog_obj, obj_under_cursor, get_object_data, get_flags, set_flags, obj_is_openable, get_proto_data, set_proto_data | - |
| Other / Game management | set_movie_path<br>stop/resume_game<br>mark_movie_played<br>game_loaded<br>get_game_mode<br>get_uptime<br>signal_close_game | implemented: game_loaded, get_game_mode, get_uptime, signal_close_game | - |
| Gameplay tweaks | set_pickpocket_max<br>set_hit_chance_max<br>set_xp_mod<br>set_critter_hit_chance_mod<br>set_base_hit_chance_mod<br>set_hp_per_level_mod<br>get_unspent_ap_bonus<br>gdialog_get_barter_mod<br>set_unspent_ap_bonus<br>get/set_unspent_ap_perk_bonus<br>set_inven_ap_cost<br>set_base_pickpocket_mod<br>set_critter_pickpocket_mod<br>get_inven_ap_cost<br>set_drugs_data<br>get_kill_counter<br>mod_kill_counter<br>set_pipboy_available | implemented: gdialog_get_barter_mod | - |
| NPCs | inc_npc_level<br>get_npc_level<br>npc_engine_level_up | not implemented | - |
| Other | get_year<br>set_dm/df_model<br>active_hand<br>toggle_active_hand<br>get/set_viewport_x/y<br>hero_select_win<br>get_light_level<br>message_str_game<br>sneak_success<br>create_spatial<br>unwield_slot<br>add_g_timer_event<br>add_extra_msg_file<br>get_metarule_table<br>metarule_exist<br>remove_timer_event<br>spatial_radius | implemented: get_year, active_hand, toggle_active_hand, get_light_level, message_str_game, add_extra_msg_file, metarule_exist | `input_funcs_available`, `nb_create_char` are deprecated in sfall and intentionally absent in CE. `add_extra_msg_file` does not support the explicit `fileNumber` form in CE. |
## Hooks
| Hook | ID | Compatibility | Notes |
| --- | --- | --- | --- |
| ToHit | `HOOK_TOHIT` | âś… | - |
| AfterHitRoll | `HOOK_AFTERHITROLL` | đźš« | Et tu |
| CalcAPCost | `HOOK_CALCAPCOST` | âś… | - |
| DeathAnim1 | `HOOK_DEATHANIM1` | đźš« | Use DEATHANIM2 instead |
| DeathAnim2 | `HOOK_DEATHANIM2` | âś… | - |
| CombatDamage | `HOOK_COMBATDAMAGE` | âś… | - |
| OnDeath | `HOOK_ONDEATH` | đźš« | - |
| FindTarget | `HOOK_FINDTARGET` | đźš« | (maybe) |
| UseObjOn | `HOOK_USEOBJON` | âś… | - |
| UseObj | `HOOK_USEOBJ` | âś… | CE notes an sfall-matching inconsistency around return code `2` behavior between interface contexts. |
| RemoveInvenObj | `HOOK_REMOVEINVENOBJ` | đźš« | - |
| BarterPrice | `HOOK_BARTERPRICE` | âś… | - |
| MoveCost | `HOOK_MOVECOST` | đźš« | - |
| ItemDamage | `HOOK_ITEMDAMAGE` | đźš« | - |
| AmmoCost | `HOOK_AMMOCOST` | đźš« | Et tu |
| KeyPress | `HOOK_KEYPRESS` | âś… | Third hook arg is currently `0`; CE doesn't use VK codes. |
| MouseClick | `HOOK_MOUSECLICK` | âś… | - |
| UseSkill | `HOOK_USESKILL` | đźš« | - |
| Steal | `HOOK_STEAL` | đźš« | Et tu |
| WithinPerception | `HOOK_WITHINPERCEPTION` | âś… | - |
| InventoryMove | `HOOK_INVENTORYMOVE` | âś… | - |
| InvenWield | `HOOK_INVENWIELD` | đźš« | - |
| AdjustFID | `HOOK_ADJUSTFID` | đźš« | - |
| CombatTurn | `HOOK_COMBATTURN` | âś… | - |
| StdProcedure | `HOOK_STDPROCEDURE` | đźš« | Et tu |
| StdProcedureEnd | `HOOK_STDPROCEDURE_END` | đźš« | - |
| CarTravel | `HOOK_CARTRAVEL` | đźš« | - |
| SetGlobalVar | `HOOK_SETGLOBALVAR` | đźš« | - |
| RestTimer | `HOOK_RESTTIMER` | đźš« | Et tu |
| GameModeChange | `HOOK_GAMEMODECHANGE` | âś… | - |
| UseAnimObj | `HOOK_USEANIMOBJ` | đźš« | Et tu; (maybe) |
| ExplosiveTimer | `HOOK_EXPLOSIVETIMER` | đźš« | - |
| DescriptionObj | `HOOK_DESCRIPTIONOBJ` | đźš« | Et tu |
| UseSkillOn | `HOOK_USESKILLON` | đźš« | Et tu |
| OnExplosion | `HOOK_ONEXPLOSION` | đźš« | (maybe) |
| SubCombatDamage | `HOOK_SUBCOMBATDAMAGE` | đźš« | (maybe) |
| SetLighting | `HOOK_SETLIGHTING` | đźš« | Et tu; (maybe) |
| Sneak | `HOOK_SNEAK` | đźš« | - |
| TargetObject | `HOOK_TARGETOBJECT` | đźš« | (maybe) |
| Encounter | `HOOK_ENCOUNTER` | đźš« | Et tu |
| AdjustPoison | `HOOK_ADJUSTPOISON` | đźš« | (maybe) |
| AdjustRads | `HOOK_ADJUSTRADS` | đźš« | (maybe) |
| RollCheck | `HOOK_ROLLCHECK` | đźš« | - |
| BestWeapon | `HOOK_BESTWEAPON` | đźš« | - |
| CanUseWeapon | `HOOK_CANUSEWEAPON` | đźš« | - |
| BuildSfxWeapon | `HOOK_BUILDSFXWEAPON` | đźš« | - |
-158
View File
@@ -3,26 +3,9 @@
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Main]
;Set to one to hide areas outside map bounds when using higher than 640x480 resolution, and to zero to disable
;EnableHighResolutionStencil=1
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Misc]
;Uncomment these lines to change the timers of how many days after the game starts Hakunin dream sequences will occur
;MovieTimer_artimer1=5000
;MovieTimer_artimer2=5000
;MovieTimer_artimer3=5000
;MovieTimer_artimer4=5000
;To start a new game somewhere other than artemple.map, uncomment the next line and set it to the map you want to load
;StartingMap=V13ent.map
;To change the 'FALLOUT II v1.02d' version string on the main menu, uncomment the next line
;You can use up to 2 %d's in this if you want to include Fallout's version number somewhere
;VersionString=FALLOUT II v1.02d
;To use a config file other than fallout2.cfg, uncomment the next line and add the name of your new file
;ConfigFile=
@@ -30,40 +13,6 @@
;If you want to load multiple patch files (up to 1000) at once, you can include a %d in the file name (sprintf syntax)
;PatchFile=patch%03d.dat
;Set to 1 to allow using the caret character '^' in dialog msg files to specify alternative text in dialogue based on the player's gender
;The text must be enclosed in angle brackets (example: <MaleText^FemaleText>)
;DialogGenderWords=0
;To change the default and starting player models, uncomment the next four lines.
;The default models can also be changed in-game via script
;MaleStartModel=hmjmps
;MaleDefaultModel=hmjmps
;FemaleStartModel=hfjmps
;FemaleDefaultModel=hfjmps
;To change the starting year, month or day, uncomment the next 3 lines
;Both StartMonth and StartDay are 0-indexed (i.e. 0 is January or the first day of a month)
;StartYear=2241
;StartMonth=01
;StartDay=01
;Set to 1 if you want the pipboy to be available at the start of the game
;Set to 2 to make the pipboy available by only skipping the vault suit movie check
;PipBoyAvailableAtGameStart=1
;Choose the damage formula used to calculate combat damage.
;Don't set this to anything other than 0 unless another mod you're using explicitly tells you to!
;0 - Fallout default
;1 - Glovz's Damage Fix
;2 - Glovz's Damage Fix with Damage Multiplier tweak
;5 - Haenlomal's Yet Another Ammo Mod
;DamageFormula=0
;Prevents you from using 0 to escape from dialogue at any time.
;DialogueFix=1
;Prevents you from using number keys to enter unvisited areas on a town map
TownMapHotkeysFix=1
;Set to 1 to use a CriticalOverrides.ini file to override the default critical table
;Set to 2 to use the default critical with bug fixes (doesn't require an ini)
@@ -71,108 +20,9 @@ TownMapHotkeysFix=1
;If the ExtraKillTypes option is enabled, this should be set to 3, with containing entries for any new types
;Must be non-zero to use the edit/get/reset_critical script functions
;OverrideCriticalTable=2
;Set to 1 to get notification of karma changes in the notification window
DisplayKarmaChanges=0
;Set to 1 to skip the 3 opening movies
;Set to 2 to also skip the splash screen
SkipOpeningMovies=0
;Change the Skilldex cursor FRM numbers
;Default is 293 for all skills
Lockpick=293
Steal=293
Traps=293
FirstAid=293
Doctor=293
Science=293
Repair=293
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;Each name in PremadePaths is limited to 11 characters
;PremadePaths=combat,diplomat,stealth
;PremadeFIDs=201,203,202
;Use this line to modify the list of cities and their associated global variables used for city reputations
;Syntax is 'city id:global id', with each city/global pair separated by a comma.
;CityRepsList=0:5001,2:5003,3:5004,4:5005,5:5006,6:5007,7:5008,8:5009,10:5011,11:5012,60:1640
;Set this to a valid path to save a copy of the console contents
;ConsoleOutputPath=console.txt
;Set to 1 to add additional pages of save slots !!! can be implemented !!!
;ExtraSaveSlots=1
;To use more than one save slot for quick saving (F6 key) without picking a slot beforehand, set the next two lines
;Quick save will cyclically overwrite saves from the first slot on the specified page to the last slot on the n-th page
;AutoQuickSave sets how many pages you want to use for quick saving (valid range: 1..10)
;Set to 0 to disable
AutoQuickSave=0
;These lines allow you to control the karma FRMs displayed on the character screen
;Number of KarmaPoints should be 1 less than number of KarmaFRMs
;KarmaFRMs=47,48,49
;KarmaPoints=-100,100
;Set to 1 to allow science and repair to be used on the player, or 2 for all critters. (Rather than only brahmin/robots)
ScienceOnCritters=0
;Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly.
BonusHtHDamageFix=1
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
;DisplayBonusDamage=1
;Set to 1 to remove the limits that stop the game from rolling critical successes/failures in the first few days of game time
RemoveCriticalTimelimits=0
;Change the colour of the font used on the main menu for the Fallout/sfall version string and copyright text
;It's the last byte ('3C' by default) that picks the colour used. The first byte supplies additional flags for this option
;1 - change the colour for the version string only
;2 - underline text for the version string
;4 - use monospace font for the version string
;MainMenuFontColour=0x000055
;Change the colour of the font used on the main menu for the button text
;MainMenuBigFontColour=0x3C
;Uncomment the next four lines to move the main menu buttons and credit text (the 'Copyright(c)' line on the main menu)
;MainMenuOffsetX=392
;MainMenuOffsetY=26
;MainMenuCreditsOffsetX=0
;MainMenuCreditsOffsetY=0
;These options modify the bullet distribution of burst attacks
;All the bullets are divided into three groups: center, left, and right
;These groups will then travel along three parallel tracks, trying to hit targets on the way
;CenterMult/Div set the ratio of how many bullets go to the center group, and the remaining are divided equally to the left and right sides
;TargetMult/Div set the ratio of how many bullets in the center group will attack the primary target directly
;Multiplier values are capped at divisor values
;ComputeSpray_CenterMult=1
;ComputeSpray_CenterDiv=3
;ComputeSpray_TargetMult=1
;ComputeSpray_TargetDiv=2
;Set to 1 to make explosions and projectiles emit light
;ExplosionsEmitLight=1
;Uncomment these lines to change explosives damage. DmgMax can be set to 9999 at max, and DmgMin is capped at DmgMax
;Dynamite_DmgMax=50
;Dynamite_DmgMin=30
;PlasticExplosive_DmgMax=80
;PlasticExplosive_DmgMin=40
;To add additional game msg files, uncomment the next line and set a comma delimited list of filenames without .msg extension
;By default, the files will have consecutive numbers assigned beginning with 0
;You can use the syntax 'filename:number' to manually assign numbers to specific msg files, with each pair separated by a comma
;If a file after the specified pair does not have a number assigned, it will have the next consecutive number from the last pair
;You need to use the message_str_game script function to get messages from the files
;ExtraGameMsgFileList=
;Set to 1 to display numbered dialogue options
NumbersInDialogue=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; Configuration ini files
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -191,17 +41,9 @@ NumbersInDialogue=0
;See the Unarmed.ini in the modders pack for an example file
;UnarmedFile=sfall\Unarmed.ini
;To change some engine parameters for the game mechanics, uncomment the next line
;TweaksFile=sfall\Tweaks.ini
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Scripts]
;Comma-separated list of masked paths to load global scripts from
;Only use single backslash \ as the directory separator
;Paths outside of scripts folder are supported
;GlobalScriptPaths=scripts\gl_*.int,scripts\sfall\gl*.int
;Uncomment the option to specify an additional directory for ini files used by scripts
;The game will search for ini files first relative to this directory and then relative to the root directory if not found
;The path length is limited to 61 characters
+115
View File
@@ -0,0 +1,115 @@
[debug]
;Set this to a valid path to save a copy of the console contents
console_output_path=
mode=log
output_map_data_info=1
show_load_info=1
show_script_messages=1
show_tile_num=1
window_height=192
window_width=300
[mapper]
default_f8_as_game=1
fix_map_inventory=0
fix_map_objects=0
ignore_rebuild_errors=0
librarian=0
override_librarian=0
rebuild_protos=0
run_mapper_as_game=0
save_text_maps=0
show_pid_numbers=0
sort_script_list=0
use_art_not_protos=0
[preferences]
brightness=1.000000
combat_difficulty=1
combat_looks=1
combat_messages=1
combat_speed=50
combat_taunts=1
game_difficulty=1
item_highlight=1
language_filter=0
mouse_sensitivity=1.000000
player_speedup=0
running=1
running_burning_guy=1
subtitles=1
target_highlight=1
text_base_delay=6.000000
text_line_delay=2.000000
violence_level=3
[screen]
resolution_x=640
resolution_y=480
scale=1
windowed=1
[sound]
cache_size=448
debug=1
debug_sfxc=1
gapless_music=1
initialize=1
master_volume=22281
music=1
music_path1=data\sound\music\
music_path2=sound\music\
music_volume=22281
sndfx_volume=22281
sounds=1
speech=1
speech_volume=22281
[system]
art_cache_size=8
color_cycling=1
critter_dat=critter.dat
critter_patches=data
cycle_speed_factor=1
executable=game
free_space=20480
hashing=1
interrupt_walk=1
language=english
master_dat=master.dat
master_patches=data
screenshots_format=png
scroll_lock=0
splash=5
[ui]
;Speed up or slow down all UI animations such as screen fade, dialog window show/hide, AC numbers roll, etc.
anim_speed=2.000000
;To use more than one save slot for quick saving (F6 key) without picking a slot beforehand
;Quick save will cyclically overwrite saves from the first slot on the specified page to the last slot on the n-th page
;auto_quick_save sets how many pages you want to use for quick saving (valid range: 1..10)
;Set to 0 to disable
auto_quick_save=3
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
display_bonus_damage=1
;Set to 1 to get notification of karma changes in the notification window
display_karma_changes=0
;Set to one to hide areas outside map bounds when using higher than 640x480 resolution, and to zero to disable
enable_high_resolution_stencil=1
iface_bar_mode=0
iface_bar_side_art=2
iface_bar_sides_ori=0
iface_bar_width=800
ignore_map_edges=0
;Set to 1 to display numbered dialogue options
numbers_in_dialogue=0
;Set to 1 to skip the 3 opening movies
;Set to 2 to also skip the splash screen
skip_opening_movies=0
splash_screen_size=1
[qol]
; Automatically open doors that are unlocked and has no script attached.
auto_open_doors=0
; Overrides distance at which walk animation is used when using an object.
use_walk_distance=5
+128
View File
@@ -0,0 +1,128 @@
;
; Game general config
;
; Fallout 2
;
[start]
; Starting year, month, day. Month and day are 0-indexed (0 = January, 0 = first day of month).
year=2241
month=6
day=24
; To start a new game somewhere other than artemple.map, set this to the map file name.
map=
; Starting (tribal) and default (jumpsuit) player models. Can also be changed in-game via script.
model_male=hmwarr
model_male_default=hmjmps
model_female=hfprim
model_female_default=hfjmps
; Set to 1 if you want the pipboy to be available at the start of the game.
; Set to 2 to make the pipboy available by only skipping the vault suit movie check.
pipboy=0
[karma]
; FRM numbers for karma icons on the character screen. Number of points entries should be 1 less than number of frms entries.
; Example: frms=47,48,49 points=-100,100
frms=
points=
[items]
; Proto IDs for healing items.
stimpak=40
super_stimpak=144
healing_powder=273
[dialog]
; Set to 1 to prevent using 0 to escape from dialogue at any time.
no_exit_hotkey=1
; Set to 1 to allow using '^' in dialog msg files to specify gender-based alternative text.
; Text must be enclosed in angle brackets, e.g. <MaleText^FemaleText>.
gender_words=0
[main_menu]
; Custom version string shown on the main menu. Supports up to two %d placeholders for the game version numbers.
; Example: FALLOUT II v1.02d
version_string=
; Font color for the version string and copyright text. Last byte picks the color (default 0x3C).
; First byte flags: 1 - version string only, 2 - underline, 4 - monospace font.
; Example: 0x000055
font_color=0
; Font color for the main menu button text.
big_font_color=0
; Pixel offset for main menu buttons.
offset_x=0
offset_y=0
; Pixel offset for the copyright text line.
credits_offset_x=0
credits_offset_y=0
[movies]
; Number of days after game start when each Hakunin dream sequence becomes available.
artimer1=90
artimer2=180
artimer3=270
artimer4=360
[combat]
; Damage formula used to calculate combat damage.
; 0 - Fallout default, 1 - Glovz's Damage Fix, 2 - Glovz's Damage Fix with Damage Multiplier tweak, 5 - Haenlomal's Yet Another Ammo Mod
; Don't change this unless another mod explicitly requires it.
damage_formula=0
; Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly.
bonus_hth_damage_fix=1
; Set to 1 to remove the time limits that prevent critical hits/misses in the first few days of the game.
remove_critical_time_limits=0
; Set to 1 to allow science and repair to be used on the player, or 2 for all critters (rather than only brahmin/robots).
science_on_critters=0
; Set to 1 to enable modified burst bullet distribution (spray mod).
burst_enabled=0
; Ratio of bullets going to the center group vs. left/right in burst attacks. Multiplier is capped at divisor.
burst_center_mult=1
burst_center_div=3
; Ratio of center-group bullets that target the primary target directly. Multiplier is capped at divisor.
burst_target_mult=1
burst_target_div=2
[explosions]
; Set to 1 to make explosions and projectiles emit light.
emit_light=0
; Dynamite damage range. Max is capped at 9999; min is capped at max.
dynamite_max=50
dynamite_min=30
; Plastic explosive damage range. Max is capped at 9999; min is capped at max.
plastic_explosive_max=80
plastic_explosive_min=40
[skilldex]
; FRM numbers for Skilldex skill cursors. Default is 293 for all skills.
lockpick=293
steal=293
traps=293
first_aid=293
doctor=293
science=293
repair=293
[worldmap]
; Set to 1 to prevent using number keys to enter unvisited areas on a town map.
town_map_hotkeys_fix=1
; Set to 1 to show travel markers on the world map, or 2 to show only when sneaking.
trail_markers=0
; Set to 1 to skip the encounter with Frank Horrigan.
disable_horrigan=0
; City reputation overrides. Syntax: city_id:global_id pairs separated by commas.
; Example: 0:5001,2:5003,3:5004
city_reputation_list=
[characters]
; Custom premade characters for the character selection screen.
; premade_paths is a comma-separated list of file names (max 11 chars each) in the premade\ folder, without extension.
; premade_fids is a comma-separated list of FRM numbers for the character portrait, matching the order of premade_paths.
; Example: premade_paths=combat,diplomat,stealth premade_fids=201,203,202
premade_paths=
premade_fids=
[text]
; Comma-separated list of extra game message file names (without .msg extension) to load from the game\ folder.
; Use 'filename:number' syntax to assign explicit IDs. Access via message_str_game script function.
extra_msg_file_list=
+100 -3
View File
@@ -2,12 +2,97 @@ plugins {
id 'com.android.application'
}
def sdlJavaBindingsDir = file('src/main/java/org/libsdl/app')
def findFetchedSdlJavaBindingsDir = { String variantName ->
String variantCap = variantName.capitalize()
File intermediatesVariantDir = file("build/intermediates/cxx/${variantCap}")
if (!intermediatesVariantDir.isDirectory()) {
throw new GradleException("SDL sync check failed: missing active CXX intermediates under ${intermediatesVariantDir}. Run externalNativeBuild${variantCap} first.")
}
File[] activeHashDirs = intermediatesVariantDir.listFiles()
if (activeHashDirs == null) {
throw new GradleException("SDL sync check failed: could not list active CXX intermediates under ${intermediatesVariantDir}.")
}
activeHashDirs = activeHashDirs.findAll { it.isDirectory() }.sort { a, b -> a.name <=> b.name }
if (activeHashDirs.size() != 1) {
throw new GradleException(
"SDL sync check failed: expected exactly one active CXX hash directory under ${intermediatesVariantDir}, found ${activeHashDirs*.name}."
)
}
File fetchedDir = file(".cxx/${variantCap}/${activeHashDirs[0].name}/arm64-v8a/_deps/sdl2-src/android-project/app/src/main/java/org/libsdl/app")
if (!fetchedDir.isDirectory()) {
throw new GradleException("SDL sync check failed: could not locate fetched SDL Java bindings under ${fetchedDir}.")
}
return fetchedDir
}
def assertSdlJavaBindingsMatch = { String variantName ->
File fetchedDir = findFetchedSdlJavaBindingsDir(variantName)
if (!sdlJavaBindingsDir.isDirectory()) {
throw new GradleException("SDL sync check failed: committed SDL Java bindings directory is missing or unreadable: ${sdlJavaBindingsDir}.")
}
File[] committedFiles = sdlJavaBindingsDir.listFiles()
if (committedFiles == null) {
throw new GradleException("SDL sync check failed: could not list committed SDL Java bindings directory: ${sdlJavaBindingsDir}.")
}
File[] fetchedFiles = fetchedDir.listFiles()
if (fetchedFiles == null) {
throw new GradleException("SDL sync check failed: could not list fetched SDL Java bindings directory: ${fetchedDir}.")
}
Set<String> committedNames = committedFiles
.findAll { it.isFile() && it.name.endsWith('.java') }
.collect { it.name }
.toSet()
Set<String> fetchedNames = fetchedFiles
.findAll { it.isFile() && it.name.endsWith('.java') }
.collect { it.name }
.toSet()
Set<String> missingFromCommitted = fetchedNames - committedNames
Set<String> extraInCommitted = committedNames - fetchedNames
if (!missingFromCommitted.isEmpty() || !extraInCommitted.isEmpty()) {
throw new GradleException(
"SDL Android Java bindings are out of sync with native SDL for ${variantName}.\n" +
"Fetched SDL dir: ${fetchedDir}\n" +
"Missing from committed bindings: ${missingFromCommitted.sort()}\n" +
"Extra committed bindings: ${extraInCommitted.sort()}\n" +
"Sync os/android/app/src/main/java/org/libsdl/app from the fetched SDL android-project sources."
)
}
List<String> changedFiles = committedNames.findAll { fileName ->
File committedFile = new File(sdlJavaBindingsDir, fileName)
File fetchedFile = new File(fetchedDir, fileName)
committedFile.getText('UTF-8') != fetchedFile.getText('UTF-8')
}.sort()
if (!changedFiles.isEmpty()) {
throw new GradleException(
"SDL Android Java bindings are out of sync with native SDL for ${variantName}.\n" +
"Fetched SDL dir: ${fetchedDir}\n" +
"Changed files: ${changedFiles}\n" +
"Sync os/android/app/src/main/java/org/libsdl/app from the fetched SDL android-project sources."
)
}
}
android {
compileSdk 32
defaultConfig {
applicationId 'com.alexbatalov.fallout2ce'
minSdk 21
minSdk 24
targetSdk 32
versionCode 4
versionName '1.3.0'
@@ -78,8 +163,20 @@ android {
}
applicationVariants.all { variant ->
tasks["merge${variant.name.capitalize()}Assets"]
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
String variantCap = variant.name.capitalize()
String syncCheckTaskName = "checkSdlJavaBindingsSync${variantCap}"
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
tasks.register(syncCheckTaskName) {
dependsOn("externalNativeBuild${variantCap}")
doLast {
assertSdlJavaBindingsMatch(variant.name)
}
}
tasks["merge${variantCap}Assets"]
.dependsOn(syncCheckTaskName)
}
}
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
@@ -186,7 +186,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
// Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead
// of TRANSPORT_LE. Let's force ourselves to connect low energy.
private BluetoothGatt connectGatt(boolean managed) {
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
try {
return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE);
} catch (Exception e) {
@@ -429,7 +429,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
}
});
}
}
}
else if (newState == 0) {
mIsConnected = false;
}
@@ -170,7 +170,7 @@ public class HIDDeviceManager {
Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol());
Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount());
// Get endpoint details
// Get endpoint details
for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
{
UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi);
@@ -251,6 +251,8 @@ public class HIDDeviceManager {
0x20d6, // PowerA
0x24c6, // PowerA
0x2c22, // Qanba
0x2dc8, // 8BitDo
0x9886, // ASTRO Gaming
};
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
@@ -271,15 +273,20 @@ public class HIDDeviceManager {
final int XB1_IFACE_SUBCLASS = 71;
final int XB1_IFACE_PROTOCOL = 208;
final int[] SUPPORTED_VENDORS = {
0x03f0, // HP
0x044f, // Thrustmaster
0x045e, // Microsoft
0x0738, // Mad Catz
0x0b05, // ASUS
0x0e6f, // PDP
0x0f0d, // Hori
0x10f5, // Turtle Beach
0x1532, // Razer Wildcat
0x20d6, // PowerA
0x24c6, // PowerA
0x2dc8, /* 8BitDo */
0x2dc8, // 8BitDo
0x2e24, // Hyperkin
0x3537, // GameSir
};
if (usbInterface.getId() == 0 &&
@@ -353,13 +360,19 @@ public class HIDDeviceManager {
private void initializeBluetooth() {
Log.d(TAG, "Initializing Bluetooth");
if (Build.VERSION.SDK_INT <= 30 &&
if (Build.VERSION.SDK_INT >= 31 /* Android 12 */ &&
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH_CONNECT, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH_CONNECT");
return;
}
if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ &&
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
return;
}
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18 /* Android 4.3 (JELLY_BEAN_MR2) */)) {
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
return;
}
@@ -524,7 +537,7 @@ public class HIDDeviceManager {
for (HIDDevice device : mDevicesById.values()) {
device.setFrozen(frozen);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -573,12 +586,18 @@ public class HIDDeviceManager {
try {
final int FLAG_MUTABLE = 0x02000000; // PendingIntent.FLAG_MUTABLE, but don't require SDK 31
int flags;
if (Build.VERSION.SDK_INT >= 31) {
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) {
flags = FLAG_MUTABLE;
} else {
flags = 0;
}
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
if (Build.VERSION.SDK_INT >= 33 /* Android 14.0 (U) */) {
Intent intent = new Intent(HIDDeviceManager.ACTION_USB_PERMISSION);
intent.setPackage(mContext.getPackageName());
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, intent, flags));
} else {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
}
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);
@@ -52,7 +52,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public String getSerialNumber() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
try {
result = mDevice.getSerialNumber();
}
@@ -74,7 +74,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public String getManufacturerName() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
result = mDevice.getManufacturerName();
}
if (result == null) {
@@ -86,7 +86,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override
public String getProductName() {
String result = null;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
result = mDevice.getProductName();
}
if (result == null) {
@@ -29,6 +29,7 @@ public class SDL {
// This function stores the current activity (SDL or not)
public static void setContext(Context context) {
SDLAudioManager.setContext(context);
mContext = context;
}
@@ -37,6 +38,10 @@ public class SDL {
}
public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
loadLibrary(libraryName, mContext);
}
public static void loadLibrary(String libraryName, Context context) throws UnsatisfiedLinkError, SecurityException, NullPointerException {
if (libraryName == null) {
throw new NullPointerException("No library name provided.");
@@ -52,10 +57,10 @@ public class SDL {
// To use ReLinker, just add it as a dependency. For more information, see
// https://github.com/KeepSafe/ReLinker for ReLinker's repository.
//
Class<?> relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = mContext.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = mContext.getClassLoader().loadClass("java.lang.String");
Class<?> relinkClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker");
Class<?> relinkListenerClass = context.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener");
Class<?> contextClass = context.getClassLoader().loadClass("android.content.Context");
Class<?> stringClass = context.getClassLoader().loadClass("java.lang.String");
// Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if
// they've changed during updates.
@@ -65,7 +70,7 @@ public class SDL {
// Actually load the library!
Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass);
loadMethod.invoke(relinkInstance, mContext, libraryName, null, null);
loadMethod.invoke(relinkInstance, context, libraryName, null, null);
}
catch (final Throwable e) {
// Fall back
@@ -60,8 +60,8 @@ import java.util.Locale;
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 26;
private static final int SDL_MICRO_VERSION = 1;
private static final int SDL_MINOR_VERSION = 32;
private static final int SDL_MICRO_VERSION = 8;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -89,11 +89,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
| InputDevice.SOURCE_CLASS_POSITION
| InputDevice.SOURCE_CLASS_TRACKBALL);
if (s2 != 0) cls += "Some_Unkown";
if (s2 != 0) cls += "Some_Unknown";
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= 23) {
tst = InputDevice.SOURCE_BLUETOOTH_STYLUS;
if ((s & tst) == tst) src += " BLUETOOTH_STYLUS";
s2 &= ~tst;
@@ -107,7 +107,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((s & tst) == tst) src += " GAMEPAD";
s2 &= ~tst;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Build.VERSION.SDK_INT >= 21) {
tst = InputDevice.SOURCE_HDMI;
if ((s & tst) == tst) src += " HDMI";
s2 &= ~tst;
@@ -146,7 +146,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((s & tst) == tst) src += " TOUCHSCREEN";
s2 &= ~tst;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (Build.VERSION.SDK_INT >= 18) {
tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
s2 &= ~tst;
@@ -163,14 +163,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
s2 &= ~FLAG_TAINTED;
if (s2 != 0) src += " Some_Unkown";
if (s2 != 0) src += " Some_Unknown";
Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
}
*/
public static boolean mIsResumedCalled, mHasFocus;
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24);
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */);
// Cursor types
// private static final int SDL_SYSTEM_CURSOR_NONE = -1;
@@ -224,9 +224,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected static SDLGenericMotionListener_API12 getMotionListener() {
if (mMotionListener == null) {
if (Build.VERSION.SDK_INT >= 26) {
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) {
mMotionListener = new SDLGenericMotionListener_API26();
} else if (Build.VERSION.SDK_INT >= 24) {
} else if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
mMotionListener = new SDLGenericMotionListener_API24();
} else {
mMotionListener = new SDLGenericMotionListener_API12();
@@ -281,7 +281,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// Load the .so
public void loadLibraries() {
for (String lib : getLibraries()) {
SDL.loadLibrary(lib);
SDL.loadLibrary(lib, this);
}
}
@@ -393,7 +393,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mHIDDeviceManager = HIDDeviceManager.acquire(this);
// Set up the surface
mSurface = createSDLSurface(getApplication());
mSurface = createSDLSurface(this);
mLayout = new RelativeLayout(this);
mLayout.addView(mSurface);
@@ -404,7 +404,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
SDLActivity.onNativeOrientationChanged(mCurrentOrientation);
try {
if (Build.VERSION.SDK_INT < 24) {
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
mCurrentLocale = getContext().getResources().getConfiguration().locale;
} else {
mCurrentLocale = getContext().getResources().getConfiguration().getLocales().get(0);
@@ -588,6 +588,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mHIDDeviceManager = null;
}
SDLAudioManager.release(this);
if (SDLActivity.mBrokenLibraries) {
super.onDestroy();
return;
@@ -766,7 +768,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
break;
case COMMAND_CHANGE_WINDOW_STYLE:
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
if (context instanceof Activity) {
Window window = ((Activity) context).getWindow();
if (window != null) {
@@ -788,6 +790,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
SDLActivity.mFullscreenModeActive = false;
}
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
}
} else {
Log.e(TAG, "error handling message, getContext() returned no Activity");
@@ -841,7 +846,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
msg.obj = data;
boolean result = commandHandler.sendMessage(msg);
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
if (command == COMMAND_CHANGE_WINDOW_STYLE) {
// Ensure we don't return until the resize has actually happened,
// or 500ms have passed.
@@ -969,15 +974,18 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* If set, hint "explicitly controls which UI orientations are allowed". */
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
}
if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
/* exact match to 'Portrait' to distinguish with PortraitUpsideDown */
boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait");
if (contains_Portrait && hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (hint.contains("Portrait")) {
} else if (contains_Portrait) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if (hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
@@ -990,8 +998,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* No valid hint, nothing is explicitly allowed */
if (!is_portrait_allowed && !is_landscape_allowed) {
if (resizable) {
/* All orientations are allowed */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* All orientations are allowed, respecting user orientation lock setting */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Fixed window and nothing specified. Get orientation from w/h of created window */
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@@ -1000,8 +1008,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* At least one orientation is allowed */
if (resizable) {
if (is_portrait_allowed && is_landscape_allowed) {
/* hint allows both landscape and portrait, promote to full sensor */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
/* hint allows both landscape and portrait, promote to full user */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else {
/* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);
@@ -1090,7 +1098,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result,
// we should stick to relative mode.
//
if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) {
if (Build.VERSION.SDK_INT < 27 /* Android 8.1 (O_MR1) */ && isDeXMode()) {
return false;
}
@@ -1180,7 +1188,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static boolean isDeXMode() {
if (Build.VERSION.SDK_INT < 24) {
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) {
return false;
}
try {
@@ -1340,23 +1348,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (isTextInputEvent(event)) {
if (ic != null) {
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
} else {
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
}
onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
onNativeKeyUp(keyCode);
return true;
}
}
if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
// on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
// they are ignored here because sending them as mouse input to SDL is messy
@@ -1371,6 +1362,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (isTextInputEvent(event)) {
if (ic != null) {
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
} else {
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
}
onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
onNativeKeyUp(keyCode);
return true;
}
return false;
}
@@ -1617,7 +1623,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private final Runnable rehideSystemUi = new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= 19) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
@@ -1670,7 +1676,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
++mLastCursorID;
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mCursors.put(mLastCursorID, PointerIcon.create(bitmap, hotSpotX, hotSpotY));
} catch (Exception e) {
@@ -1686,7 +1692,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static void destroyCustomCursor(int cursorID) {
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mCursors.remove(cursorID);
} catch (Exception e) {
@@ -1700,7 +1706,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/
public static boolean setCustomCursor(int cursorID) {
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mSurface.setPointerIcon(mCursors.get(cursorID));
} catch (Exception e) {
@@ -1755,7 +1761,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
cursor_type = 1002; //PointerIcon.TYPE_HAND;
break;
}
if (Build.VERSION.SDK_INT >= 24) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type));
} catch (Exception e) {
@@ -1769,7 +1775,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI.
*/
public static void requestPermission(String permission, int requestCode) {
if (Build.VERSION.SDK_INT < 23) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
nativePermissionResult(requestCode, true);
return;
}
@@ -1798,7 +1804,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
i.setData(Uri.parse(url));
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
} else {
flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
@@ -2002,6 +2008,18 @@ class SDLInputConnection extends BaseInputConnection {
@Override
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
if (beforeLength > 0 && afterLength == 0) {
// backspace(s)
while (beforeLength-- > 0) {
nativeGenerateScancodeForUnichar('\b');
}
return true;
}
}
if (!super.deleteSurroundingText(beforeLength, afterLength)) {
return false;
}
@@ -1,5 +1,8 @@
package org.libsdl.app;
import android.content.Context;
import android.media.AudioDeviceCallback;
import android.media.AudioDeviceInfo;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioRecord;
@@ -8,34 +11,67 @@ import android.media.MediaRecorder;
import android.os.Build;
import android.util.Log;
public class SDLAudioManager
{
import java.util.Arrays;
public class SDLAudioManager {
protected static final String TAG = "SDLAudio";
protected static AudioTrack mAudioTrack;
protected static AudioRecord mAudioRecord;
protected static Context mContext;
private static final int[] NO_DEVICES = {};
private static AudioDeviceCallback mAudioDeviceCallback;
public static void initialize() {
mAudioTrack = null;
mAudioRecord = null;
mAudioDeviceCallback = null;
if(Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */)
{
mAudioDeviceCallback = new AudioDeviceCallback() {
@Override
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
Arrays.stream(addedDevices).forEach(deviceInfo -> addAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
}
@Override
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
Arrays.stream(removedDevices).forEach(deviceInfo -> removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
}
};
}
}
public static void setContext(Context context) {
mContext = context;
if (context != null) {
registerAudioDeviceCallback();
}
}
public static void release(Context context) {
unregisterAudioDeviceCallback(context);
}
// Audio
protected static String getAudioFormatString(int audioFormat) {
switch (audioFormat) {
case AudioFormat.ENCODING_PCM_8BIT:
return "8-bit";
case AudioFormat.ENCODING_PCM_16BIT:
return "16-bit";
case AudioFormat.ENCODING_PCM_FLOAT:
return "float";
default:
return Integer.toString(audioFormat);
case AudioFormat.ENCODING_PCM_8BIT:
return "8-bit";
case AudioFormat.ENCODING_PCM_16BIT:
return "16-bit";
case AudioFormat.ENCODING_PCM_FLOAT:
return "float";
default:
return Integer.toString(audioFormat);
}
}
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
int channelConfig;
int sampleSize;
int frameSize;
@@ -43,14 +79,14 @@ public class SDLAudioManager
Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz");
/* On older devices let's use known good settings */
if (Build.VERSION.SDK_INT < 21) {
if (Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
if (desiredChannels > 2) {
desiredChannels = 2;
}
}
/* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */
if (Build.VERSION.SDK_INT < 22) {
if (Build.VERSION.SDK_INT < 22 /* Android 5.1 (LOLLIPOP_MR1) */) {
if (sampleRate < 8000) {
sampleRate = 8000;
} else if (sampleRate > 48000) {
@@ -59,7 +95,7 @@ public class SDLAudioManager
}
if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) {
int minSDKVersion = (isCapture ? 23 : 21);
int minSDKVersion = (isCapture ? 23 /* Android 6.0 (M) */ : 21 /* Android 5.0 (LOLLIPOP) */);
if (Build.VERSION.SDK_INT < minSDKVersion) {
audioFormat = AudioFormat.ENCODING_PCM_16BIT;
}
@@ -120,7 +156,7 @@ public class SDLAudioManager
channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER;
break;
case 8:
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) {
channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
} else {
Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround");
@@ -201,6 +237,10 @@ public class SDLAudioManager
return null;
}
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
mAudioRecord.setPreferredDevice(getOutputAudioDeviceInfo(deviceId));
}
mAudioRecord.startRecording();
}
@@ -224,6 +264,10 @@ public class SDLAudioManager
return null;
}
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
mAudioTrack.setPreferredDevice(getInputAudioDeviceInfo(deviceId));
}
mAudioTrack.play();
}
@@ -238,11 +282,73 @@ public class SDLAudioManager
return results;
}
private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS))
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
.findFirst()
.orElse(null);
} else {
return null;
}
}
private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS))
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
.findFirst()
.orElse(null);
} else {
return null;
}
}
private static void registerAudioDeviceCallback() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
audioManager.registerAudioDeviceCallback(mAudioDeviceCallback, null);
}
}
private static void unregisterAudioDeviceCallback(Context context) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback);
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames);
public static int[] getAudioOutputDevices() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
} else {
return NO_DEVICES;
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] getAudioInputDevices() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
} else {
return NO_DEVICES;
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
}
/**
@@ -254,6 +360,11 @@ public class SDLAudioManager
return;
}
if (android.os.Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
Log.e(TAG, "Attempted to make an incompatible audio call with uninitialized audio! (floating-point output is supported since Android 5.0 Lollipop)");
return;
}
for (int i = 0; i < buffer.length;) {
int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING);
if (result > 0) {
@@ -326,18 +437,22 @@ public class SDLAudioManager
/**
* This method is called by SDL using JNI.
*/
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames);
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
}
/** This method is called by SDL using JNI. */
public static int captureReadFloatBuffer(float[] buffer, boolean blocking) {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
return 0;
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
}
}
/** This method is called by SDL using JNI. */
public static int captureReadShortBuffer(short[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
return mAudioRecord.read(buffer, 0, buffer.length);
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -346,7 +461,7 @@ public class SDLAudioManager
/** This method is called by SDL using JNI. */
public static int captureReadByteBuffer(byte[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) {
return mAudioRecord.read(buffer, 0, buffer.length);
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -391,4 +506,9 @@ public class SDLAudioManager
}
public static native int nativeSetupJNI();
public static native void removeAudioDevice(boolean isCapture, int deviceId);
public static native void addAudioDevice(boolean isCapture, int deviceId);
}

Some files were not shown because too many files have changed in this diff Show More