Tool RPGM Python script to run RPGM games on browser

NanoRein

New Member
Nov 29, 2018
14
19
Hello, first time posting here
Today I tried to play Summer Memories by Dojin Otome/Kagura Games on Linux. Tried to use nwjs but the performance was so horrible, tried to use the browser using the http.server from python but it didn't work.
The problem was that since on Windows; file names are case insensitive, however on Linux they're not. That was a problem since the game tried to access the files with proper filenames, but the file names were not exact and differed in case of some letters(window_0 vs Window_0 etc.). So I made this little python script to simulate the Windows behavior and wanted to share it with you all:
Python:
from pathlib import Path
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer

PATHS = {}
for path in Path('.').glob('**/*'):
    name = str(path.resolve())
    PATHS[name.lower()] = name


class DualStackServer(ThreadingHTTPServer):
    def server_bind(self):
        try:
            self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
        except Exception:
            pass
        return super().server_bind()


class Handler(SimpleHTTPRequestHandler):
    def translate_path(self, path):
        path = super().translate_path(path)
        return PATHS.get(path.lower(), path)


def main(server_class=DualStackServer, handler_class=Handler):
    DualStackServer(('127.0.0.1', 8000), Handler).serve_forever()


if __name__ == '__main__':
    main()
 
  • Like
Reactions: womb0comb0