Commit Graph
206 Commits
Author SHA1 Message Date
Nunuhara Cabbage 6080af3621 Implement Sound_GetGroupNumFromDataNum
Part of StoatSpriteEngine and KiwiSoundEngine.

This fixes an issue with per-channel volume settings not working
correctly in Haruurare (and presumably other games).
2022-05-04 20:30:03 -07:00
Nunuhara Cabbage 5924225bc2 Implement DrawGraph.BrightDestOnly 2022-05-03 21:08:01 -07:00
Nunuhara Cabbage 7fc60f6607 Implement DrawGraph.ScreenDA_DAxSA 2022-05-03 20:48:21 -07:00
Nunuhara Cabbage 44891458f1 Implement DrawGraph.SaturDP_DPxSA 2022-05-03 20:01:48 -07:00
Nunuhara Cabbage 703a66106f Implement DrawGraph.FillMultiply 2022-05-03 18:57:06 -07:00
Nunuhara Cabbage af33413826 Implement DrawGraph.FillScreen 2022-05-03 18:53:55 -07:00
Nunuhara Cabbage 54f6ece82d Implement DrawGraph.FillAMapGradationUD 2022-05-03 18:49:40 -07:00
Nunuhara Cabbage 3b75b6b545 Implement DrawGraph.BlendScreenAlpha
This completes the full suite of DrawGraph blending functions.
2022-05-02 21:18:49 -07:00
Nunuhara Cabbage e65560b67a Implement DrawGraph.BlendMultiply 2022-05-02 20:48:42 -07:00
Nunuhara Cabbage 2fd081234b Implement DrawGraph.BlendScreen 2022-05-02 20:43:16 -07:00
Nunuhara Cabbage 65be47e05b Implement DrawGraph.BlendUseAMapColor 2022-05-02 20:35:02 -07:00
Nunuhara Cabbage 9108ce19ea Implement DrawGraph.BlendAMapAlphaSrcBright 2022-05-02 18:19:09 -07:00
Nunuhara Cabbage 2f573803c4 Implement DrawGraph.BlendAMapBright 2022-05-02 17:01:23 -07:00
Nunuhara Cabbage 6d745054a4 Implement DrawGraph.BlendAMapSrcOnly 2022-05-02 16:20:40 -07:00
Nunuhara Cabbage 0fc5442e42 Implement DrawGraph.BlendAddSatur 2022-05-02 15:38:53 -07:00
Nunuhara Cabbage d482e165d6 Implement DrawGraph.BlendSrcBright 2022-05-02 15:12:40 -07:00
Nunuhara Cabbage 237fbebcf5 Implement EFFECT_ZOOM_LR and EFFECT_ZOOM_RL
Used in Sengoku Rance.

These are implemented using DrawGraph primitives since it's simpler than
writing a shader in this case.
2022-05-01 11:43:24 -07:00
Nunuhara Cabbage 8d381dbf49 Ensure _ModuleInit runs after VM reset
Fixes crash after game over in MangaGamer version of Sengoku Rance.
2022-05-01 08:23:05 -07:00
Nunuhara Cabbage f7b6da9679 Implement DrawGraph.BlendAMapColorAlpha
Used in the Rance VI credits.
2022-04-28 20:43:55 -07:00
Nunuhara Cabbage 9089fa1fd1 Rewrite fnl font renderer
Only unscaled glyph bitmaps are now cached in regular memory. Scaled
glyphs are stored as textures on the GPU. Only the alpha channel on
glyph textures is used, with the color being provided as an input to the
shader.

Outline and bold rendering is improved by using a simple dilate shader.
This looks okay but could be improved (the result is a bit blurry
still).
2022-04-28 19:13:27 -07:00
Nunuhara Cabbage 8fb0153963 SengokuRanceFont: anti-aliasing and glyph caching
This improves the look and (especially) the performance of text
rendering in the MangaGamer version of Sengoku Rance.

There are still some bugs/unimplemented features, but the game should be
more or less bearable to play in this state.
2022-04-24 17:19:27 -07:00
Nunuhara Cabbage 3b72b88e9c SengokuRanceFont improvements
The game now basically runs, but with very bad performance and lots of
aliasing on text.

Need to implement anti-aliasing and caching of rendered glyphs next.
2022-04-23 22:52:07 -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 0ab9a59e99 Implement SystemService.SetMixerName
Used in Rance VI (at game over screen).
2022-04-14 16:21:24 -07:00
Nunuhara Cabbage 21cb503c06 Read debugger config at startup
Read .xsys4-debugrc from ~/.xsystem4 and/or the game directory on
startup. This is just a text file with one debugger command per line.
Can be used to set breakpoints or log functions automatically at
startup.

This can also be used to work around a limitation on Windows where the
IME doesn't work in the debugger, making it impossible to input Japanese
text.
2022-04-14 10:54:00 -07:00
Nunuhara Cabbage 9ede2d7af9 debugger: add vm-state command
Add vm-state command, which prints disassembly around the current
instruction pointer and the current contents of the stack.

It was necessary to change how breakpoints are implemented for this.
When adding a breakpoint, the original opcode now remains in the
instruction stream, bitwise-or'd with BREAKPOINT. A hash table indexed
by address is used to store breakpoint objects.
2022-04-14 09:08:57 -07:00
Nunuhara Cabbage caf11f3991 Debugger improvements
* Add "frame" command to change the current frame.
* Add "members" command to print struct members for current frame (if it's
  a method frame).
* Support printing member variables (e.g. "this.var") in the "print"
  command.
2022-04-12 19:18:05 -07:00
Nunuhara Cabbage 912a73d42a Implement HLLs for English version of Rance VI 2022-04-10 18:24:47 -07:00
Nunuhara Cabbage 5581417937 Implement SACT2.WP_SetSP
Used in English version of Rance VI.
2022-04-10 09:04:00 -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 95a7719b65 Implement DrawGraph.CopyRotateX,CopyRotateXUseAmap
Used in Tsuma Shibori.
2022-04-08 18:43:51 -07:00
Nunuhara Cabbage 11e4880def Handle all font weights
System 4 has 4 font weights: light, medium, bold and heavy bold.
SDL_ttf has 2 (normal and bold). For now, xsystem4 treats light/medium
as normal and bold/heavy-bold as bold.
2022-04-05 19:33:56 -07:00
Nunuhara Cabbage e88ae62c08 Remove scene_flip function
It was a bug to call this function outside of sact_Update, because it
set scene_is_dirty to false without first rendering the scene. This can
cause the scene to not be rendered in a timely manner.
2022-04-05 19:31:13 -07:00
Nunuhara Cabbage 5fe61c14d9 Rance 02: render '^' as 'é' 2022-04-04 21:26:23 -07:00
Nunuhara Cabbage f01f002a54 Improve performance of vm_save_image
cJSON_AddArrayItem is O(n), which made saving arrays O(n^2). This was
causing extremely poor performance when saving large arrays, such as
those created by MultiSprite_Encode.

A special cJSON_CreateIntArray_cb function is now used instead, which
can create and populate an array in O(n).
2022-04-03 13:42:36 -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 73eb1d0e34 Merge branch 'master' of github.com:nunuhara/xsystem4 2022-03-27 15:47:09 -07:00
Nunuhara Cabbage 5dfb82afd7 parts: ConstructionProcess (WIP)
A very partial implementation of some ConstructionProcess functionality.
2022-03-27 15:40:18 -07:00
kichikuou e047ae1c85 Do not call destructors on uninitialized structs in json_to_vm_value()
For structs / arrays, json_to_vm_value() calls json_load_page() on
freshly allocated pages for which no constructor has been called.
json_load_page() should not call destructors for such uninitialized
pages.

json_load_page() is also called by BanMisc.LoadStruct and File.Read,
with an initialized struct. In that case destructors should be called.

This fixes crash in Widenyo after system.GroupLoad.
2022-03-25 12:06:00 +09:00
kichikuou f725e4e830 Implement ChrLoader.LoadWavFile 2022-03-25 10:49:25 +09:00
kichikuou ba1dcd6e21 Fix StoatSpriteEngine.SP_SetDrawMethod
The method parameter of this function has a different meaning from that
of SACT2.SP_SetDrawMethod.

I've only checked it in Widenyo, but it seems 0 and 1 are valid values
and 1 is additive blending.
2022-03-25 10:49:25 +09:00
kichikuou 2707bc9a7e Implement MapLoader HLL
For Widenyo.

Now sprite_set_cg() takes a struct cg, so that CG can be loaded from
custom sources such as .map file.
2022-03-25 10:29:30 +09:00
kichikuou a76948244e Implement two SystemService.dll functions
For Widenyo.
2022-03-24 22:00:35 +09:00
kichikuou fc41239175 Remove include/file.h
It was an outdated duplicate of system4/file.h.
2022-03-21 21:23:20 +09:00
Nunuhara Cabbage 5b2f9d7536 Refactor GoatGUIEngine and add misc. stubs
Refactor GoatGUIEngine into various files under src/parts/.
The external interface to this code is the functions prefixed with PE_
and generally following the naming of the HLL functions which they
implement.

The reason for this is that there are multiple HLL libraries that
implement more or less the same GUI interface (GoatGUIEngine, GUIEngine
and PartsEngine).

Also added here are a number of miscellaneous stubbed-out HLL functions
that are used by Rance 01 (which now runs up to the point where it tries
to create the title menu).
2022-01-30 10:12:20 -08:00
Nunuhara Cabbage 9904754f06 Add interface for loading CGs by name 2022-01-30 10:03:59 -08:00
Nunuhara Cabbage 6f750e4007 More delegate fixes
1. DG_CALL has to clean up the stack before jumping to the return
   address.
2. DG_SET (contrary to its name) is an append operation; it's basically
   a combination of DG_NEW_FROM_METHOD and DG_PLUSA.
3. DG_SET and DG_PLUSA need to check for and ignore duplicates.
4. Delegate pages store *references* to structs; the VM should NOT copy
   the struct page when copying a delegate page.
2022-01-29 09:55:42 -08:00
Nunuhara Cabbage b7aaa1897b Implement A_SORT_MEM
Sorts an array of structs by a given member.
2022-01-23 15:11:48 -08:00