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

Loading bitmap files outside Data folder #193

Open
JoaoFelipe opened this issue Mar 28, 2018 · 5 comments
Open

Loading bitmap files outside Data folder #193

JoaoFelipe opened this issue Mar 28, 2018 · 5 comments

Comments

@JoaoFelipe
Copy link

JoaoFelipe commented Mar 28, 2018

Hi, I'm developing a translation system for Rakuen that replaces game images by translated images in a distinct directory (outside Data): https://github.com/JoaoFelipe/rakuen-translation/blob/f999882557bf085f2456fe6ca22c4f77f300fc40/mods/translation/languages.rb#L315

It works on rpg maker engine, but when I try to execute it with mkxp, it doesn't find the file, but states the right path. Is this a mkxp limitation? Any suggestions on a workaround?

@JoaoFelipe
Copy link
Author

I managed to load the external images by moving the mods directory to Data, but it is still an inconsistency between the engines. So I will leave the issue open.

@Ancurio
Copy link
Owner

Ancurio commented Mar 28, 2018

Can you isolate a test case where mkxp doesn't load a Bitmap correctly?

@JoaoFelipe
Copy link
Author

Here it is: https://github.com/JoaoFelipe/mkxp-issue193
In the Override_Bitmap script I have:

class Bitmap
  alias_method :old_initialize, :initialize
  
  def initialize(*args)
    if args.size == 1
      result = args[0]
      if args[0] == "Graphics/Titles/TitleBG"
        result = "#{Dir.getwd}/TitleBG.png"
      end
      args[0] = result
    end
    old_initialize(*args)
    
  end
end

It basically overrides the Graphics/Titles/TitleBG (that is configured as the game title image) by TitleBG.png in the project root.

The Game.exe from rpg maker xp works, but neither mkxp.exe nor mkxp.amd64 are able to load the file in the project root.

@ReinUsesLisp
Copy link
Contributor

ReinUsesLisp commented Mar 29, 2018

I can reproduce it. It seems to be a bug (since you say it doesn't fail on Game.exe).

For now, just remove Dir.getwd:

# replace
result = "#{Dir.getwd}/TitleBG.png"
# with
result = "TitleBG.png"

I think this is because PhysFS (or Filesystem object) is not searching in absolute paths.

@Ancurio
Copy link
Owner

Ancurio commented Mar 29, 2018

I think this is because PhysFS (or Filesystem object) is not searching in absolute paths.

I haven't tested yet, but this is a strong contender for the issue. @JoaoFelipe Is there a reason you need to prefix the path with the absolute current directory? mkxp always resolves paths to assets (bitmaps, music) relative to the game directory, so it should work even if you're outside the Data or Graphics folder; being outside the game folder however would be a bit problematic.

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

No branches or pull requests

3 participants