Commit Graph
998 Commits
Author SHA1 Message Date
Nunuhara Cabbage ff26a7f646 Merge pull request #122 from kichikuou/majo
Fix graphics issues found in Majo no Shokuzai
2023-06-03 13:07:02 -07:00
kichikuou 7dd85e445e Fix DrawGraph.CopyRotateY*
The back side sprite should not appear as a mirror image.
2023-06-03 13:18:13 +09:00
kichikuou 4f22907004 Fix DrawGraph.CopyRotZoom*
The `w` and `h` parameters are clamped to the source texture size.
2023-06-03 13:18:13 +09:00
Nunuhara Cabbage ddc9f1ae12 DAP: add scene/parts requests
xsystem4.scene: returns a list of scene entities
  * all entities have an entityId that can be used in further requests
  * SACT2 sprites have a 'sprite' member with a spriteId that can be
    used in further requests

xsystem4.renderEntity: renders a scene entity and returns the texture
xsystem4.spriteTexture: returns the stored SACT2 sprite texture
xsystem4.renderParts: renders a parts object and returns the texture
xsystem4.partsTexture: returns the stored parts object texture

Image data in texture objects is RGB8888 encoded in base 64.
2023-05-26 08:44:36 -07:00
Nunuhara Cabbage 7392d74efe Replace debug_print with to_json
to_json and cJSON_Print are now used when displaying debug information.

The main reason for this change it to support sending objects over DAP.
2023-05-14 20:12:34 -07:00
Nunuhara Cabbage 535a1f1804 Merge branch 'master' of github.com:nunuhara/xsystem4 2023-05-13 12:14:12 -07:00
Nunuhara Cabbage d387ee2816 Merge pull request #121 from kichikuou/dungeon
DrawDungeon: Fix cell drawing order
2023-05-13 12:13:13 -07:00
kichikuou dc174fa91c DrawDungeon: Fix cell drawing order
Transparent objects should be drawn in order from furthest to nearest.
In DrawDungeon, the actual viewpoint is slightly behind the camera, but
this was not taken into account when sorting cells by distance.

Fixes #120
2023-05-13 11:27:45 +09:00
kichikuou cf318bb47c Add debug print function for DrawDungeon plugin
For now it just prints the camera position.
2023-05-13 10:56:36 +09:00
Nunuhara Cabbage d0a2c5ec40 Fix vm_exit when called before vm_execute_ain
The can happen when launched in the debugger and then exited before
starting execution.
2023-05-07 15:32:29 -07:00
Nunuhara Cabbage cff6272c18 Always use absolute path for config.home_dir
And by extension config.save_dir. This fixes an issue where paths
retrieved by system.GetSaveFolderName and then passed to gamedir_path
would become invalid.

Fixes #115
alpha-4.2
2023-05-06 08:29:12 -07:00
Nunuhara Cabbage e808d770a9 Merge pull request #118 from kichikuou/fade
Fix channel volume after fade completion
2023-05-06 07:49:23 -07:00
Nunuhara Cabbage 63067d32d3 Merge pull request #116 from kichikuou/SystemService
Add two SystemService functions
2023-05-06 07:48:57 -07:00
kichikuou f9e9f20c05 Fix channel volume after fade completion
This fixes https://github.com/nunuhara/xsystem4/issues/117.
2023-05-05 10:01:58 +09:00
kichikuou 3ee2f703a4 Add two SystemService functions
- Implement SystemService.GetGameVersion
- Add stub for SystemService.AddURLMenu
2023-05-04 21:06:34 +09:00
Nunuhara Cabbage 7b512485e6 DAP: implement disconnect command
Also, fix bug in setInstructionBreakpopints response.
2023-05-03 17:19:03 -07:00
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 4ad893c147 Merge pull request #114 from kichikuou/windows-fix
Fix character encoding issue in vm_stack_trace()
2023-04-23 11:18:57 -07:00
kichikuou 381e644a42 Fix character encoding issue in vm_stack_trace() 2023-04-23 21:34:35 +09:00
Nunuhara Cabbage ba81077c2e Fix performance issue with PartsEngine text
Don't allocate massive textures for each text object. Instead, allocate
a texture for each character and then compose them onto an appropriately
sized texture.

Fixes a performance issue in Rance 01.
2023-04-16 15:44:58 -07:00
Nunuhara Cabbage f7cf2264fa Fix multiple issues with resetting HLLs
Clear PartsEngine/SACT2/CharSpriteManager/audio state when resetting the
VM.

Fixes #113
2023-04-14 16:00:40 -07:00
Nunuhara Cabbage 9bb4665fa9 Add changes to vm.h
Missed this file in the last commit.
2023-04-14 15:57:22 -07:00
Nunuhara Cabbage 4c9c23f620 Merge branch 'master' of github.com:nunuhara/xsystem4 2023-04-14 15:16:10 -07:00
Nunuhara Cabbage 75d6386e25 Fix ResumeSave/ResumeLoad bugs with delegates
When loading a delegate, the stored objects must be registered to it.

Also, delegate_call cannot use vm_execute because the VM cannot be
resumed from such a state.

Incidentally, this means that ResumeSave cannot be called from within a
constructor/destructor (since they also use vm_execute), but this is
probably not a problem.
2023-04-14 15:08:45 -07:00
Nunuhara Cabbage 983944a776 Implement PartsEngine Save/Load
The format should not be considered stable at this point, as PartsEngine
support is still experimental and subject to change. But it's useful to
have these functions for testing purposes.
2023-04-14 10:30:36 -07:00
Nunuhara Cabbage 373903cdb5 Implement ChipmunkSpriteEngine.SP_RenderView
Used to create save thumbnails in Shaman's Sanctuary.
2023-04-14 07:55:57 -07:00
Nunuhara Cabbage 4b1257fc13 Fix delegate memory management
Although delegate pages store references to objects on the heap,
adding/removing objects from a delegate does not affect their reference
counts. When an object that is a member of a delegate is deleted, it is
automatically removed from the delegate.

In practice, this means that every object needs to keep a list of
delegates that it belongs to. This increases the size of the page header
on 64 bit systems, but not by much since the additional metadata can be
stored in a union with the array-specific metadata.
2023-04-13 16:38:13 -07:00
Nunuhara Cabbage 0416d4f1f7 Merge pull request #112 from kichikuou/msgbox
Fix garbled characters in message box on Windows
2023-04-13 16:35:55 -07:00
kichikuou 911f82cda0 Fix garbled characters in message box on Windows
SDL MessageBox functions expect UTF-8 strings even in Japanese-locale
Windows.
2023-04-13 17:55:02 +09:00
Nunuhara Cabbage e4ed459376 Implement miscellaneous PartsEngine functions 2023-04-10 21:48:09 -07:00
Nunuhara Cabbage 46f25755c5 Add PartsEngine HLL (Oyako Rankan version)
The game currently runs up until the first unimplemented function
(SeekEndMotion) during the intro events, using the existing PE_
functions with a few minor fixes.
2023-04-10 15:16:14 -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 cc199dcf4e Add notes directory 2023-04-05 19:28:30 -07:00
Nunuhara Cabbage baae8f5237 Document Windows FFmpeg build, etc.
Statically link FFmpeg on Windows. This requires building a slimmed-down
version of FFmpeg from source. The build process is documented in the
README.

Also add ffmpeg dependency to the nix flake.
alpha-4.1
2023-04-02 19:34:45 -07:00
Nunuhara Cabbage 8437a87b54 Merge pull request #111 from kichikuou/ffmpeg
Add FFmpeg movie backend
2023-04-02 12:31:29 -07:00
kichikuou b11a173b67 Add FFmpeg movie backend
This allows playback of videos in encodings other than MPEG-1, e.g. VC-1
used in the English version of Rance VI.

The FFmpeg dependency is optional. If it's not available, the PL_MPEG
backend will be used.
2023-04-01 13:59:55 +09:00
Nunuhara Cabbage 0e18f69cbf build: require meson >= 0.59 and cglm >= 0.8.3
get_option('<option>').allowed() requires meson >= 0.59.

glm_quat_nlerp requres cglm >= 0.8.3.
2023-03-28 22:41:49 -07:00
Nunuhara Cabbage c3f9d93917 Link statically on Windows
Try to link statically as much as possible on Windows, to reduce the
number of DLLs that have to be shipped with Windows builds.

Also document the build process on Windows.
alpha-4
2023-03-29 03:09:20 -07:00
Nunuhara Cabbage ac411754a0 Merge pull request #109 from kichikuou/sact
Change the second parameter of `sact_SP_SetShow` from bool to int
2023-03-27 06:26:08 -07:00
kichikuou 45ebaa2c7f Set debug printing function for sprites initialized with CGs 2023-03-27 20:13:27 +09:00
kichikuou a923b0ce23 Change the second parameter of sact_SP_SetShow from bool to int
In SACT2 it's declared as int, so any integer can be passed. A Sengoku
Rance mod actually passes 2, but some compilers generate code that
interprets it as false.
2023-03-27 20:13:27 +09:00
Nunuhara Cabbage 1be2cffd22 Merge pull request #108 from kichikuou/msgskip
Use System4-compatible MsgSkip file format
2023-03-25 23:20:02 -07:00
kichikuou 50af8bd3ff Use System4-compatible MsgSkip file format 2023-03-24 20:05:17 +09:00
Nunuhara Cabbage 32ef29ee20 Merge pull request #107 from kichikuou/savefile
Use global/group save file format compatible with System4
2023-03-20 22:24:59 -07:00
kichikuou 8620be452e Ignore non-existent structure fields when loading from gsave
This matches System4's behavior.
2023-03-19 22:18:28 +09:00
kichikuou cc79f9caee Use global/group save file format compatible with System4
After this, xsystem4 uses the global/group save format used by the
original System4, instead of the JSON format. Existing JSON save files
can still be loaded.

This makes save files interoperable between System4 and xsystem4 in some
games, including Sengoku Rance and Toushin Toshi III.
2023-03-19 11:42:20 +09:00
Nunuhara Cabbage 6a2eae7274 Merge pull request #106 from kichikuou/sact
sact_SP_TextDraw: Early return if sprite size is zero
2023-03-18 16:47:02 -07:00
kichikuou 66002f7ceb sact_SP_TextDraw: Early return if sprite size is zero
Otherwise it ERROR()s in gfx_set_framebuffer() due to an incomplete
framebuffer.

This happens when trying to display text without specifying a message
window in SACT2. AliceSoft's implementation ignores this.
2023-03-17 22:11:41 +09:00
Nunuhara Cabbage d1b18f39dd Add flake.nix 2023-03-09 19:37:42 -08:00
Nunuhara Cabbage dbd1e54c46 Merge branch 'master' of github.com:nunuhara/xsystem4 2023-03-07 18:21:21 -08:00