Commit Graph
998 Commits
Author SHA1 Message Date
Nunuhara Cabbage ae56a0f4b4 fnl: Fix reported width of tab character
The reported size of the tab character seems to be roughly 2.88x the
size of the glyph in the font.

This fixes a text layout issue with the commander info (HP, Job, etc).
2022-05-02 07:54:43 -07:00
Nunuhara Cabbage 6e05874ee1 Implement SACT2.QuakeScreen and EFFECT_OSCILLATE 2022-05-01 13:27:55 -07:00
Nunuhara Cabbage ccf049b4d5 Implement fade effects
Implement EFFECT_FADEOUT, EFFECT_FADEIN, EFFECT_WHITEOUT and
EFFECT_WHITEIN.

I'm not aware of these being used in any game (fade effects seem to be
implemented manually most of the time).
2022-05-01 12:06:53 -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 b0d1549964 fnl: implement space_scale_x
Fixes some text layout issues.

Text rendering/layout in the MangaGamer version of Sengoku Rance is now
basically working as intended.
2022-04-30 11:15:06 -07:00
Nunuhara Cabbage a25f066a05 fnl: eliminate text halo
Fill fully-transparent pixels on the destination texture with the text
color before rendering to it. This eliminates halos around text caused
by the invisible texture color (usually black) being blended with the
text.
2022-04-30 10:52:55 -07:00
Nunuhara Cabbage 0d771384da Fix SengokuRanceFont.SP_SetTextMetricsClassic
This function doesn't overwrite values in the text style that aren't
contained in the sact_text_metrics_t object.
2022-04-30 06:33:20 -07:00
Nunuhara Cabbage f2dd4def12 Fix bug in gfx_draw_glyph
blend_amap_color_shader now uses the alpha value.
2022-04-29 18:13:22 -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 547524d07b SACT2: render sprites in correct order for same Z
If two sprites have the same Z value, they are rendered in increasing
order of their sprite numbers.

This fixes an issue in the MangaGamer version of Sengoku Rance, which
depends on this behavior.
2022-04-21 19:04:20 -07:00
Nunuhara Cabbage 76710475fb Simplify/fix SACT2 sprite code
This code was changed at some point so that sact_get_sprite allocates a
sprite and only returns NULL for a negative sprite index, but some
functions were still assuming that it could return NULL under normal
circumstances and trying to manually allocate sprites.

I've gone through all of the SP_* functions to check which ones allocate
a sprite and which ones don't. If a function doesn't allocate a sprite,
sact_try_get_sprite is called instead of sact_get_sprite.

This fixes a crash on startup in the MangaGamer version of Sengoku
Rance (SengokuRanceFont.SP_ClearState was incorrectly allocating a
sprite).
2022-04-20 20:57:44 -07:00
Nunuhara Cabbage 06d51dc30e Include <limits.h> in system4.c
Per #46
2022-04-19 16:45:33 -07:00
Nunuhara Cabbage e8481d04c0 Note glew dependency in README
Per #46
2022-04-19 16:44:29 -07:00
Nunuhara Cabbage da12d6183e Remove "invalid keycode" warnings
Some games (e.g. Rance VI) just scan through all all keys up to 256 when
waiting for input.
2022-04-18 07:19:32 -07:00
Nunuhara Cabbage 3d5f63a583 Handle special character mapping in Rance VI (EN) 2022-04-17 17:03:38 -07:00
Nunuhara Cabbage 8639e53348 debugger: correctly print bool, lint and NULL 2022-04-17 15:24:00 -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).
alpha-2
2022-04-17 09:44:44 -07:00
Nunuhara Cabbage 55aed4c755 Implement EFFECT_TURN_PAGE
Used in Rance VI.
2022-04-16 21:51:12 -07:00
Nunuhara Cabbage c1e9099a6c Implement EFFECT_LINEAR_BLUR
Used in Rance VI.
This implementation is not perfect, but it gets pretty close.

Alicesoft's implementation has a sharper curve on the blur size around
t=0.5, giving a "snappy" effect at the middle of the transition.
2022-04-16 10:47:59 -07:00
Nunuhara Cabbage 5b436ed98e Merge pull request #45 from kichikuou/compat-table
Update game_compatibility.md
2022-04-15 18:50:24 -07:00
Nunuhara Cabbage f58c1b43bc audio: fix corner cases in fade implementation
Properly handle the case where the stream loops while fading, by
tracking the elapsed frame count rather than comparing the current frame
with a computed end position.

Properly handle the case where time=0, by applying the volume
immediately instead of in the audio callback.

This fixes some audio bugs in Rance VI.
2022-04-15 11:31:55 -07:00
kichikuou 92ee64dcb8 Update game_compatibility.md
- Change DALK外伝 and ままにょにょ to unsupported
- Expand ALICEの館7 games
2022-04-15 19:45:07 +09: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 68ca748296 Fix bug in vm_free
This function is not supposed to call destructors, but was calling
heap_unref instead of exit_unref on local pages.

Fixes a bug in Rance VI where the game would crash on game over.
2022-04-14 16:19:26 -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 78354cbdaf audio: seek to 0 when stopping stream
Fix issue in Rance VI where BGM would resume playing from the previous
position instead of restarting after a stream was stopped.

Also fix an issue where a stale sample could be played when starting a
stream after it had been stopped.
2022-04-11 21:25:31 -07:00
Nunuhara Cabbage af3af870fa Add game compatibility table 2022-04-11 18:54:50 -07:00
Nunuhara Cabbage 5e1ab7894f Respect UseJoypad value in System40.ini
Joypad support is enabled if UseJoypad = true. This can be overridden by
the --joypad option, which now takes an optional argument, which may be
"off".
2022-04-11 18:05:51 -07:00
Nunuhara Cabbage 951834fb57 Improve joypad input mapping
Implement buttons 1-4 as left analog stick directions (with cooldown) to
match SACT2.

Other buttons are also remapped to match the SACT2 mapping.
2022-04-11 17:45:21 -07:00
Nunuhara Cabbage 34fa732f91 Use fallback for unimplemented effects
Use EFFECT_BLUR_CROSSFADE as a fallback for unimplemented effects.
2022-04-10 18:50:49 -07:00
Nunuhara Cabbage 3507ebc609 Fix texture leak in sprite_set_cg_2x 2022-04-10 18:43:41 -07:00
Nunuhara Cabbage 5bff9aa922 Fix channel_play/channel_stop return values
The corresponding SACT2 functions return 1 if the channel is already
playing/stopped.

This eliminates some error message spam on the console.
2022-04-10 18:33:32 -07:00
Nunuhara Cabbage 912a73d42a Implement HLLs for English version of Rance VI 2022-04-10 18:24:47 -07:00
Nunuhara Cabbage ef8ebadc7e Fix bug in SACT2.CG_IsExist 2022-04-10 15:32:41 -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 75bb6d1e43 Guard against division by zero in MOD 2022-04-10 09:02:30 -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 322eccb371 Simplify sact_Effect 2022-04-09 09:02:52 -07:00
Nunuhara Cabbage a48704e0e2 Daibanchou: fix BGM/Sound indexing
Fix issue where wrong sounds/music are played in Daibanchou.
2022-04-08 20:07:48 -07:00
Nunuhara Cabbage 95a7719b65 Implement DrawGraph.CopyRotateX,CopyRotateXUseAmap
Used in Tsuma Shibori.
2022-04-08 18:43:51 -07:00
Nunuhara Cabbage ac248c310c Fix -e encoding on Windows alpha-1 2022-04-07 18:22:01 -07:00
Nunuhara Cabbage 38df5ea1c1 Use display_sjis0/display_utf0 in messages
Ensure correct encoding for error/warning/log messages.
2022-04-06 19:33:33 -07:00
Nunuhara Cabbage b45e8e73dc Fix replaying animation bug in StoatSpriteEngine
Fix a bug where animations would replay after calling
StoatSpriteEngine.MultiSprite_EndAllMove (e.g. the start of battle
animation in Rance 02 replaying after every attack).
2022-04-06 17:55:28 -07:00
Nunuhara Cabbage 48b53881de Fix bug in load_heap 2022-04-06 17:51:39 -07:00