Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDL2 port, remove useless dependencies like GLEW/GLU #86

Draft
wants to merge 56 commits into
base: sdl2
Choose a base branch
from

Conversation

a1batross
Copy link

  • SDL2 provides GLEW functionality, so I dropped it off.
  • GLU was used for only one purpose is to show OpenGL error message. It was got removed too. I think, it can be replaced with GL_KHR_debug/GL_ARB_debug_output in future.
  • Probably gtk removal commit should be reverted partially, as there is no way to show file picker under Linux. I have implemented SDL2 platform to use it where GTK is not usable, like Android.
  • Mostly it compiles and works(under Android too), but nothing of yours todo's were implemented.

This is not finished yet and probably will be updated for proper Linux support.

eglaysher added 30 commits May 4, 2015 12:00
Instead of storing the raw bytecode string of expression elements
and then parsing them on demand, just parse the expression now
that the ExpressionPiece is cheap.

This similarly changes parts of the selection interface. (Also,
I don't see any uses of passing a non-default window number to
select_w in any games that I've disassembled locally.)
This is a cherry-pick of da0ccd7 from
the SDL2 branch; the fix also works in old SDL.

This forces the audio quality to 44.1 khz audio. This fixes the static
that showed up on some sounds in the sdll2 port. (When applying this
patch to the old sdl1 branch, it also fixes the problem where some of
the sound effects are higher pitched than they should be.)

Conflicts:
	src/systems/sdl/sdl_sound_system.cc
This doesn't change the license; this just puts it in the common license location so github's automated stuff Just Works.
This changes all embedded images from PNG to XPM and modifies our
convenience copy of SDL_image so that it is slimmed down to just the XPM
code; this "fixes" the current problems of the png code, which is never
used outside of the fallback icon on Linux and some small image
resources used in the built in menus for early RealLive games.

Closes eglaysher#68.
In cases of "intX[<integer>] = <integer>", we use a simple assignment
ExpressionPiece which stuffs all data into a single ExpressionPiece.
This reverts commit 691a70f.

This fix caused tonal problems with voices in Clannad FV edition.

This is eglaysher#72 in the bug tracker.
RealLiveMAX appears to have Western line breaking support, and the
English edition of CLANNAD uses it. (In the CLANNAD prologue, we now
only differ on one line, and we're more conservative in our breaking.)

Closes eglaysher#71.
For some reason, SEEN9820 of the English edition of Clannad is using
CallStackSize(). If we don't have this, we crash to the main menu at the
end of the Prologue.

Closes eglaysher#74.
Line breaking logic now works on a perfect character grid, while
character layout works by measuring the size of an individual
glyph. When we're using msgothic.ttc, use the monospace calculations,
and when using basically any other font, put the characters together.

(Sadly, SDL_ttf doesn't let us do real kerning here, but we at least
don't look terrible anymore.)

Closes eglaysher#70.
Previously, when the user would push the mouse button down, that event
was routed to the TextoutLongOperation, which would replaced itself with
the PauseLongOperation. That pause operation then received the mouse up
event and would immediately continue. By making TextoutLongOperation
only act on mouse up, we don't leak a mouse up to the next long
operation.

(Tested in the English version of planetarian.)

Closes eglaysher#75, eglaysher#59.
It appears the signature of the overloads changed sometime between when
Haeleth was working on Kanon and now.
Adds <iostream> to GraphicsObject.

Closes eglaysher#76.
In 28e4a60, we started dealing with a sort of g00 file that was first
used in Tomoyo After, where all regions had the same boundaries. This
previously broke the Little Busters Refrain, and now is causing problems
for the waku buttons in the Clannad English Edition.

This extends the logic so that it detects images that have only one
region specified multiple times. It looks like the logic which allocates
more room doesn't need to change.

Closes eglaysherGH-69.
This feature is used in the English Edition of Clannad to replace the
Japanese names with their Romanized versions.

Closes eglaysherGH-73.
This is the first confirmed run through an English edition path on
rlvm!!
When there's an embedded set of quotes (i.e. "Say \"Hello.\""), we would
not detect that the second escaped quote was escaped and would end on
it. This was causing a crash in Tomoyo's route in the English Edition of
Clannad.

Closes eglaysherGH-77.
eglaysher and others added 21 commits July 2, 2016 20:58
Clannad English Edition confirmed completable in rlvm.
Tested this in Clannad. This doesn't trigger that often, but about half
the time that it does, it's evaluating that 0 == 0.
This doesn't fix the real problem with eglaysherGH-72, but it does paper over it
enough so that we can release.
src/systems/base/gan_graphics_object_data.cc:56:12: error: no member named 'cerr' in namespace 'std'
using std::cerr;
      ~~~~~^
Unbreak build with Boost 1.69
@a1batross a1batross changed the base branch from master to sdl2 May 9, 2019 22:27
@eglaysher
Copy link
Owner

FWIW, the sdl2 branch was in an incomplete state when I stopped work on it. I think. It's been multiple years since I last looked at this. I vaguely remember that I was having problems with getting the audio to be the right pitch and it was a sampling issue (hence trying to pull a resampling library in, but I don't remember what state that work was in).

@a1batross
Copy link
Author

I don't remember also, but didn't heard any pitch issues. Maybe I'm too deaf. :)

I just found this on my old laptop and I decided to upload here and... I don't have time to continue porting yet. :(

@JeodC
Copy link

JeodC commented Jul 10, 2024

What about this isn't done @a1batross? I just came across this and got interested.

@a1batross
Copy link
Author

@JeodC nothing really, I guess. You're free to take this branch and continue working on it.

@JeodC
Copy link

JeodC commented Jul 10, 2024

@JeodC nothing really, I guess. You're free to take this branch and continue working on it.

I compiled it in bullseye and it works, so it's functional lol.

@JeodC
Copy link

JeodC commented Jul 10, 2024

I run into two problems when using clannad from the "safe" branch (2015) off steam. Note that I'm using gl4es and mali drivers.

  1. BGM isn't playing after starting the game for the second time, somehow tied to the presence of global.sav.gz. This is a regression from the upstream.
  2. The sdl window has some artifact issues, namely the textures underneath the transparent textbox are scaled larger than the rest of the screen.

IMG_6847

I've been fiddling with glViewport etc in sdl_graphics_system.cc for a while, but to no avail. Related to the texture scaling problem, I did end up having to remove most of void SDLGraphicsSystem::RedrawLastFrame since it would scale textures too large each time it was called.

@JeodC
Copy link

JeodC commented Jul 14, 2024

An update to this for posterity:

I intend to distribute a rlvm binary for use on retro handheld devices running linux, with mali blobs and gl4es wrapper.

I ended up going with the SDL1 version (upstream) for my distributions. SDL2 is incomplete and has other issues outlined above. For SDL1, I ran into two major problems which I managed to resolve:

  1. Textbox shaders - Marking the textbox for transparency effects resolves the texture splitting issue imaged above. This made the textbox a solid color though, not transparent. I updated the shaders.cc file with modern function names, and it resolved that problem.

  2. Effects texture rendering larger than screen - On aspect ratios other than 4:3, textures rendered during effects would be drawn too large for the screen. To resolve this, I did the following in src/effects/effect.cc:

bool Effect::operator()(RLMachine& machine) {
  unsigned int time = machine.system().event().GetTicks();
  unsigned int current_frame = time - start_time_;

  bool fast_forward = machine.system().ShouldFastForward();

  if (current_frame >= duration_ || fast_forward) {
    return true;
  } else {
    // We don't have glOrtho here, so just forget this bit since it's the cause of a render bug.
    /*
    GraphicsSystem& graphics = machine.system().graphics();
    graphics.BeginFrame();
    if (BlitOriginalImage()) {
      dst_surface().RenderToScreen(
          Rect(Point(0, 0), size()), Rect(Point(0, 0), size()), 255);
    } 

    PerformEffectForTime(machine, current_frame);

    graphics.EndFrame();
    return false;
    */
   return true;
  }
}

This effectively removes effects from the game. I realize these are band-aids and I realize gl4es probably didn't exist back in 2014. Anyway, notes for whoever might need them in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants