Commit Graph
25 Commits
Author SHA1 Message Date
Nunuhara Cabbage d4e06db8e2 Initial DAP implementation
So far only basic debugging functionality is implemented (breakpoints,
stepping, stack traces/variables).

This is not tested against an established DAP client. My intention is to
create a custom GUI frontend and extend the protocol to support
xsystem4-specific features, such as inspecting the scene. (This work is
underway.)

Instruction references are hex-encoded address strings. Clients do not
need to obtain them from DAP requests. This is outside the spec, but it
is needed for a binary-only debugger.

Functions that write directly to stdout (e.g. printf) should generally
not be used any more.  Instead, use either sys_message (which respects
sys_silent) or log_message (which will send the message to the debugger
if DAP is enabled). stderr can be used as normal.
2023-04-29 10:32:50 -07:00
Nunuhara Cabbage 249e447920 asset_manager: use built-in afa index
The afa implementation from libsys4 now handles basename indexing, so we
use that instead of creating a separate index. Also, afa v1 is now
properly supported in libsys4, so there is no need for the
id_indexed_afa hack.
2023-04-09 10:02:07 -07:00
Nunuhara Cabbage 6b62e1db23 Fix CG loading functions for Rance Quest
Rance Quest uses strings for CG names, but the strings contain numbers
which should be converted to integers for lookup.
2023-02-11 16:36:05 -08:00
kichikuou 6efa31454d Do not use ARCHIVE_MMAP on 32-bit systems
Some games have assets that are too large to mmap everything on a 32-bit
address space. For example, TT3 has a total of 2.82GB of assets, which
is too large for the 3GB address space limit of 32-bit Linux. On Android
it's even stricter and mmaps of hundreds of MB can fail.
2022-11-26 22:29:57 +09:00
Nunuhara Cabbage caec854ed8 Implement scene_print function
Add a scene_print function which prints a textual representation of the
current scene. This works by attaching a `debug_print` function to each
entity in the scene. This function is implemented for SACT2 and
GUIEngine entities. A default implementation will be used of none is
provided.

This can be accessed from the debugger via the `scene` command (although
the output is typically too much to view in a terminal; it's better to
run `scene_print` somewhere and redirect stdout to a file).
2022-06-10 19:18:10 -07:00
Nunuhara Cabbage 19ac7e6935 Refactor asset_manager (again)
There are now two types of asset management:
    1. ID-indexed assets, where IDs are not necessarily sequential
    2. name-indexed assets

Name-indexed assets can have additional archives added at run-time. This
is to support the CGManager.LoadArchive function used in Rance Quest
Magnum.

Name-indexed assets always use .afa archives. ID-indexed assets mostly
use .ald archives, except for Daiteikoku and Shaman's Sanctuary.

asset_get_by_name is now case insensitive and ignores the file
extension.
2022-06-05 19:15:41 -07:00
Nunuhara Cabbage 9b83a6d09d Refactor text rendering code
.fnl fonts can now be used outside of SengokuRanceFont, and
SengokuRanceFont now uses the same text layout and caching code as
SACT2, etc.
2022-05-14 23:12:36 -07:00
Nunuhara Cabbage 3d5f63a583 Handle special character mapping in Rance VI (EN) 2022-04-17 17:03:38 -07:00
Nunuhara Cabbage 9bcd17a151 Add --font-x-scale option
Add an option to control the horizontal scaling of text. This is mainly
to work around text overflow issues in the MangaGamer version of Rance
02 (an appropriate value is set automatically for that game).
2022-04-17 09:44:44 -07:00
Nunuhara Cabbage eca92c4f7e Add compatibility hack for English Daibanchou
Gpx2Plus.CopyStretchReduceAMap behaves differently in the English
version.

Fixes an issue with text being squashed horizontally on the regional
phase menus.
2022-04-09 11:42:17 -07:00
Nunuhara Cabbage 5fe61c14d9 Rance 02: render '^' as 'é' 2022-04-04 21:26:23 -07:00
Nunuhara Cabbage 5713742a99 Implement MultiSprite_Encode/MultiSprite_Decode 2022-04-03 13:41:34 -07:00
Nunuhara Cabbage 9fbc9ec5b7 Implement simple command-based debugger interface
Add a new debugger interface using a simple command language. This is
less powerful than the scheme interface (which still exists) but more
ergonomic for interactive debugging.

This debugger has no external dependencies (it will however use readline
if available) and is included in builds by default.

A sample interaction might look like:

    xsystem4 --debug /path/to/game
    dbg(cmd)> breakpoint bar
    Set breakpoint at function 'bar' (0x00001234)
    dbg(cmd)> continue
    Hit breakpoint at function 'bar' (0x00001234)
    dbg(cmd)> backtrace
    #0 0x00001234 in bar
    #1 0x00002222 in foo
    #2 0x00004444 in main
    dbg(cmd)> locals
    [0] i: 2
    [1] s: "baz"
    dbg(cmd)> locals 1
    [0] j: 3
    [1] obj: { m_i = 0; m_s = "" }
    dbg(cmd)> quit
2022-04-01 19:38:55 -07:00
Nunuhara Cabbage 5f221d939f Add -e,--echo-message option
Add option to echo messages to standard output. Messages are prefixed
with "MSG %d:" so that they can be filtered by a script.
2021-12-11 09:57:46 -08:00
Nunuhara Cabbage 51d21612d2 Implement some SystemService.dll functions
For Rance 01.
2021-10-26 11:45:50 -07:00
Nunuhara Cabbage 488ccc0c74 Implmement MainEXFile HLL (Rance 01 version)
Implement the Rance 01 version of MainEXFile (later versions have a
different interface).
2021-10-22 18:34:39 -07:00
Nunuhara Cabbage f53184d8f7 Implement System40.ini/AliceStart.ini mixers
Implement "VolumeValancer" mixer channels from the .ini file. Mixers are
now recursive, with the master and voice channels being parent nodes
(this seems to be hardcoded in system 4, or at least I haven't found
where the hierarchy is specified).

Also implement .wai file support (needed for mixer channel info on sound
files).
2021-10-03 09:26:48 -07:00
Nunuhara Cabbage ab5c86b1fa Implement joypad support 2021-09-19 20:28:51 -07:00
Nunuhara Cabbage 815c1f20f0 Default font types > 1 to 0 2021-05-24 11:15:50 -07:00
kichikuou ce004ee3cc Make {gamedir,savedir}_path accept absolute paths
This fixes Rance VI which passes SACT2.SP_SaveCG and
SACT2.SP_SetCGFromFile absolute paths like
`system.GetSaveFolderName() + "\\" + "ScreenA.qnt"`.

Also, now savedir_path() uses unix_path() rather than sjis2utf().
2021-05-22 17:07:14 +09:00
Nunuhara Cabbage f25e26ecf4 Refactor archive management code
Implement a new interface for managing archives. This is mainly to
support loading afa archives alongside ald archives.

Also included here is some code for creating an index for afa CG
archives (the numbers used to reference CGs in afa archives correspond
to the file name, not the position in the archive).
2021-05-16 08:06:40 -07:00
Nunuhara Cabbage 152aa8275a Implement various things used in Haruka
* system.ExistFunc
* Math.log + Math.log10
* SystemService mixer functions
2021-04-25 15:40:15 -07:00
Nunuhara Cabbage a901404d3c Declare global variables extern in headers
Recent versions of gcc seem to emit symbols for unadorned declarations,
leading to linker errors.
2020-09-03 10:15:25 -07:00
Nunuhara Cabbage 0e4e52a25d Refactor audio to enable bgm looping
SDL_mixer reads loop information from WAV files if you use the Mix_Music
interface, but NOT the Mix_Chunk interface. So bgm now uses the
Mix_Music interface to get proper looping.

There's also some code here for reading bgi files (taken from xsystem35)
but it's not actually used. There doesn't seem to be a simple way to set
up custom loops with SDL_mixer.
2020-07-12 12:07:40 -07:00
Nunuhara Cabbage 58da6dc167 Refactor system4.h
Move xsystem4-specific declarations to xsystem4.h.
2020-07-12 09:17:52 -07:00