Commit Graph
1030 Commits
Author SHA1 Message Date
kichikuou 2bc9a3d2cb MainEXFile: Fix Col() to accept EX_LIST
MainEXFile.Col() returns the number of items for EX_LIST handles.

Also removed the FIXME comments from Row and Col since the semantics
appear correct.
2026-04-10 14:29:20 +09:00
kichikuou 1e29930f4c MainEXFile: Fix set_indices/map_handles for EX_LIST
items->value was always indexing the first item; use items[i].value
to properly assign IDs and map handles for all list items.
2026-04-10 14:22:20 +09:00
kichikuou 887eebf31d MainEXFile: Add stub for ReloadDebugEXFile 2026-04-10 14:16:02 +09:00
kichikuou 03062d5d61 KiwiSoundEngine: Fix asset lookup for Rance 9
In Rance 9 (and Blade Briders), KiwiSoundEngine looks up BGM and sound
files in archives by name formatted as "%05d" rather than by archive
index. Since the Sound_Seek function only exists in these games' HLL
definitions, its presence is used to switch Music_IsExist, Music_Prepare,
Sound_IsExist and Sound_Prepare to name-based lookups at PreLink time.
2026-04-08 08:52:51 +09:00
kichikuou fe952354c5 PartsEngine: Add initial support for Flat animation
Only nested timelines and CG rendering are implemented. Stop motion and
particle emitters are not yet implemented.
2026-04-05 13:52:27 +09:00
Nunuhara Cabbage f43ca3a31a Merge pull request #316 from kichikuou/PartsEngine
Link PartsEngine.UpdateComponent to PartsEngine_Update()
2026-04-03 22:17:13 -07:00
kichikuou 92b2dd1990 Link PartsEngine.UpdateComponent to PartsEngine_Update()
PartsEngine.UpdateComponent() is a three-argument function that
corresponds to the older PartsEngine's Update() function.

PE_UpdateComponent is a one-argument function for
GUIEngine.UpdateComponent().
2026-04-04 09:51:11 +09:00
kichikuou f8ce39a324 Add SealEngine HLL stub
SealEngine is a successor to TapirEngine, the 3D engine used in Rance 9,
Evenicle, etc.
2026-04-04 07:50:58 +09:00
kichikuou 623b3d3407 PartsEngine: Implement AddFillWithAlphaToPartsConstructionProcess 2026-04-02 13:21:34 +09:00
kichikuou 39886c30bd PartsEngine: Add stubs for some functions 2026-04-02 13:05:15 +09:00
kichikuou 1ad496c28d PartsEngine: Add HLL_(TODO_)EXPORTs for functions added in Rance 9
As noted in notes/parts-engine.md, many functions have been renamed.
They link to existing PE_ functions.

Some functions have had their arguments or return values changed from
int to float. For now, they just use the existing int functions.
2026-04-01 16:15:38 +09:00
Nunuhara Cabbage 039f1c9a2e Merge pull request #313 from kichikuou/CGManager
Implement CGManager functions for Rance 9
2026-03-31 21:36:04 -07:00
kichikuou 38610d93bb Implement CGManager functions for Rance 9 2026-03-30 16:54:36 +09:00
kichikuou 65fa898d9f Destruct struct members in reverse order of declaration
Class members are destroyed in the reverse order of their declaration
(like C++). The previous code destroyed members in declaration order,
which caused a use-after-free in Rance 9's T_Map class.

Added a test to verify the reverse destruction order.
2026-03-29 16:13:46 +09:00
kichikuou 197b89620c Fix extra heap_unref for ref arguments in delegate calls
When a delegate finishes calling all registered functions,
variable_fini() was called on the original stack arguments. For ref
types, this results in an unbalanced heap_unref() because the caller
pushes raw ref-values without incrementing the reference count. Non-ref
string/struct/array arguments are not affected because their push
instructions allocate new heap slots with ownership.

This fixes use-after-free in T_Loop@checkSelect in Rance 9.
2026-03-28 08:18:41 +09:00
kichikuou ecc04bc9bb Implement DG_NEW and DG_STR_TO_METHOD instructions
Used in Rance 9.
2026-03-28 08:18:41 +09:00
kichikuou 2ad0de6663 ChipmunkSpriteEngine: Add draw method 2 (multiply) support
This fixes a bug in Rance Quest where certain maps were not rendering.
2026-03-20 07:25:24 +09:00
kichikuou d93bb91d72 Add support for Pascha3 Plus Contents
Two changes from Pastel Chime 3 (likely to make the executables
incompatible):

- SystemService.XXX function
- PartsEngine.Update() has two dummy string parameters
2026-03-10 16:41:55 +09:00
kichikuou 1ad7cbb2c5 Fix array.Alloc(negative number)
array.Alloc(negative number) should create an empty array.

This fixes crash in C_HOSPITAL_ABILITY_SWITCH_PADDING::Create() in
Pastel Chime 3.
2026-03-07 11:31:43 +09:00
kichikuou a476b1d892 Implement KiwiSoundEngine.Sound_GetDataLength
Used in Pastel Chime 3.
2026-03-07 11:31:43 +09:00
kichikuou d4121032db system.ExistFile() should return false if path ends with a backslash
The system.ExistsFile() system call returns 1 if a file or directory
exists, but returns 0 when the provided path ends with a directory
separator, regardless of whether a directory exists at that location.

This subtle difference in behavior caused problems in Pastel Chime 3.
2026-03-07 11:31:43 +09:00
kichikuou 9474e321e1 Fix ChipmunkSpriteEngine.SP_SetDrawMethod
The meaning of the method parameter is the same as that of
StoatSpriteEngine.SP_SetDrawMethod.

This fixes a visual issue in Pastel Chime 3's battle scene.
2026-03-07 11:31:43 +09:00
kichikuou e66fe928e5 debugger_dap: Add null check to add_page_to_array()
This fixes a crash when inspecting an empty array with the `variables`
command.
2026-03-03 08:13:55 +09:00
kichikuou 6e755b21ef Update ChipmunkSpriteEngine to use the parts vertex shader
And set the `use_clipper` uniform to false.
2026-03-01 10:59:07 +09:00
kichikuou a5d488564a Implement PartsEngine.SetPartsAlphaClipperPartsNumber
This allows a specified part to be used as an alpha map (clipper) during
rendering. A dedicated vertex shader (parts.v.glsl) is introduced to
calculate clipping coordinates using an inverse transformation matrix.

Refactored parts_render_text() to use parts_render_texture() so that
alpha clipping is applied to text. This also enables color modifications
for text, while rotation and scaling remain unsupported, matching the
original PartsEngine behavior.

Incremented the parts save version since alpha_clipper_parts_no is now
persisted.
2026-03-01 07:47:40 +09:00
kichikuou 205e0a3ed0 Implement PartsEngine.ExistsFlashFile
Used in Pastel Chime 3.
2026-03-01 07:31:50 +09:00
kichikuou b758a04760 PartsEngine.SetPartsCG: Accept <save> path
This fixes an issue where thumbnails do not display on the save screen
in Pastel Chime 3.

If `cg_name` starting with "<save>" is passed, the function loads the CG
from the save directory.

Note that unlike GoatGUIEngine.SetPartsCG() in Rance Quest, `cg_name`
does not include "SaveData\\".
2026-03-01 07:31:50 +09:00
kichikuou 9c962e3467 Implement PartsEngine.AddGrayFilterToPartsConstructionProcess
It applies a grayscale filter to a specified area of the parts.
2026-03-01 07:31:36 +09:00
kichikuou 5ac79311b9 Implement P3SquareSprite HLL
This library is used to visualize unit movement area in the isometric
map.
2026-02-24 08:38:45 +09:00
kichikuou 75cfc9f18d Implement P3MapSprite HLL
This library is for rendering the isometric map grid in Pastel Chime 3.
It manages a background texture and an isometric grid texture. The grid
is generated from a sprite tile and an array representing tile
visibility. It provides functions to create, delete, and copy/blend
these textures onto destination sprites.
2026-02-24 08:38:45 +09:00
kichikuou eaa7f3d8d0 Implement MADLoader HLL
This HLL provides functionality for loading, managing, and rendering
animations stored in the MAD file format. A MAD file consists of a
header followed by a series of QNT image frames.
2026-02-24 08:38:45 +09:00
Nunuhara Cabbage 0d7ef9b577 Merge pull request #303 from brombrom-hani/system-service-rance-9
SystemService: Function in rance 9
2026-02-23 06:16:22 -08:00
BromBrom-Hani e662955a1d SystemService: Function in rance 9 2026-02-21 18:37:34 +01:00
kichikuou a3c23387f4 Treat invalid global group name as empty group
Pastel Chime 3 executes system.GroupSave() with a group name of
"共有データ", but that group name does not exist in the OBJG section of
AIN.

Pascha3.exe does not treat such system.GroupSave() calls as failures,
instead behaving as if saving an empty variable group.
2026-02-21 11:02:39 +09:00
kichikuou 30ac11e74b Fix use-after-free in custom string array sort
Custom comparison functions for string arrays receive their arguments by
value. Create a copy of the strings before pushing them to the stack to
prevent them from being prematurely freed after the function call.
2026-02-16 08:49:33 +09:00
kichikuou 7540712de1 Add stub for PartsEngine.SetPartsAlphaClipperPartsNumber
For Pastel Chime 3.
2026-02-15 09:35:24 +09:00
kichikuou 6a75bc5a6b flash: reset playback state in PE_BackPartsFlashBeginFrame
This fixes a bug in Pastel Chime 3 where message progression would hang
because the Flash animation failed to resume playback after being reset.
2026-02-15 09:12:03 +09:00
kichikuou a1a809faef VSFile: Support relative paths from the game directory
Relative paths are used in Pastel Chime 3.
2026-02-14 12:41:04 +09:00
kichikuou 3929de81f1 Add stubs for AFAFactory hll 2026-02-14 12:41:01 +09:00
kichikuou 65ccb29423 Add ValueEncryption HLL
This appears to be an anti-cheat mechanism. To make save files
compatible, it should do the same calculation as the original,
but for now we just return the values as they are.
2026-02-14 12:36:58 +09:00
Nunuhara Cabbage 9f3af7b256 Merge pull request #299 from kichikuou/fnl
fnl: Fix glyph width handling
2026-02-07 08:23:45 -08:00
kichikuou 621eb49be8 fnl: Fix glyph width handling
This fixes the row stride calcuration for the second font of Pastel
Chime 3.
2026-02-06 16:47:15 +09:00
kichikuou 5f13b3e9d0 Fix crash on Windows introduced in commit ed2239f
Memory allocated with xcalloc_aligned (which uses _aligned_malloc on
Windows) must be freed with _aligned_free. Using standard free() caused
heap corruption and crashes.
2026-02-06 16:29:14 +09:00
kichikuou ed2239fb1b Use xcalloc_aligned for allocating structures containing mat4
This fixes #294.

cglm's mat4 requires 32-byte alignment when __AVX__ is defined.
2026-01-13 08:17:31 +09:00
kichikuou 5980e49a96 Update libsys4
There is no need to call initialize_instructions() in system4.c, because
ain_open() initializes the instruction set internally when it reads the
VERS tag.
2026-01-13 08:11:33 +09:00
BromBrom d6b5bde80c SystemService: fullscreen control 2025-11-15 13:42:20 +01:00
kichikuou 93ce40bcdd parts: Fix ERROR() in flash.c
This fixes a crash when processing DefineSprite tags that contain no
PlaceObject2 tags, as seen in Rance Quest's `Battle/斧攻撃・雷.aff`.
These sprites are now registered in parts_flash->sprites with a NULL
object, and are safely skipped by the renderer.
2025-10-30 09:48:22 +09:00
kichikuou d1fdab4cde Add Android support for SystemService.OpenPlayingManual
The heavy lifting will be done on the Java side. Here we just send a
message.
2025-10-18 13:43:10 +09:00
kichikuou 180c81e5f5 debugger_dap: Defer starting execution until configuration is done
The debugger previously started execution upon receiving a 'launch'
request. This created a race condition where execution could begin
before breakpoints were set by the client.

This change ensures the debugger waits for both 'launch' and
'configurationDone' requests before starting the debugee. This allows
the client to set breakpoints before execution begins.
2025-10-11 11:20:35 +09:00
kichikuou 1e682bad09 debugger_dap: Fix garbled characters in output events on Windows 2025-10-11 09:49:16 +09:00