eglaysher / rlvm

RealLive clone for Linux and OSX
http://rlvm.net
GNU General Public License v3.0
150 stars 25 forks source link

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

Open a1batross opened 5 years ago

a1batross commented 5 years ago

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

eglaysher commented 5 years ago

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 commented 5 years ago

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 commented 1 month ago

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

a1batross commented 1 month ago

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

JeodC commented 1 month ago

@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 commented 1 month ago

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 commented 1 month ago

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.