BinBashBanana / webretro

RetroArch in your browser
https://binbashbanana.github.io/webretro/
MIT License
249 stars 350 forks source link

some problems #26

Closed nenge123 closed 2 years ago

nenge123 commented 2 years ago

I test the "mednafen_psx_hw_libretro" not well

can you can bulid the "pcsx_rearmed_libretro" ?

[Uploading 录像recorder (3).webm…]()

lost method. Module._cmd not have Module["cwrap"] to call run. Module.cwrap('cmd_cheat_get_code', '', [])();


//such as
// Module["cwrap"] = cwrap;
function cwrap(ident, returnType, argTypes, opts) {
        return function () {
          return ccall(ident, returnType, argTypes, arguments, opts)
        }
      }

      function ccall(ident, returnType, argTypes, args, opts) {
        var toC = {
          "string": function (str) {
            var ret = 0;
            if (str !== null && str !== undefined && str !== 0) {
              var len = (str.length << 2) + 1;
              ret = stackAlloc(len);
              stringToUTF8(str, ret, len)
            }
            return ret
          },
          "array": function (arr) {
            var ret = stackAlloc(arr.length);
            writeArrayToMemory(arr, ret);
            return ret
          }
        };

        function convertReturnValue(ret) {
          if (returnType === "string") return UTF8ToString(ret);
          if (returnType === "boolean") return Boolean(ret);
          return ret
        }
        var func = getCFunc(ident);
        var cArgs = [];
        var stack = 0;
        assert(returnType !== "array", 'Return type should not be "array".');
        if (args) {
          for (var i = 0; i < args.length; i++) {
            var converter = toC[argTypes[i]];
            if (converter) {
              if (stack === 0) stack = stackSave();
              cArgs[i] = converter(args[i])
            } else {
              cArgs[i] = args[i]
            }
          }
        }
        var ret = func.apply(null, cArgs);
        ret = convertReturnValue(ret);
        if (stack !== 0) stackRestore(stack);
        return ret
      }
BinBashBanana commented 2 years ago

can not "fast-forward"

this is a bug in v6.5, it will be fixed in v6.6 (see #21)

i play the "Dragon Quest Monsters 1 & 2" lost my character, I seem to remember that the ios app seems to have this problem too.

this is probably a bug with the hardware renderer, try using the software renderer as it is more accurate but it can be slower (see #24)

Instructions for using the software renderer: before choosing ROM files, go to the menu at the top, "More" > "Pre-start Options" > "Use Software Renderer" (check)

or for your UI, here is the code (use before callMain)

FS.createPath("/", "home/web_user/retroarch/userdata/config/Beetle PSX HW", true, true);
FS.writeFile("/home/web_user/retroarch/userdata/config/Beetle PSX HW/Beetle PSX HW.opt", 'beetle_psx_hw_renderer = "software"\n');

state save very very slow.

I'll see what I can do about this in the next release, but it won't be able to get much better without completely disabling the compression.

can you can build the "pcsx_rearmed_libretro" ?

I could, but the software renderer on Beetle/Mednafen PSX is more accurate, and decently fast too.

lost method. Module._cmd not have Module["cwrap"] to call run. Module.cwrap('cmd_cheat_get_code', '', [])();

I'm not sure what you're saying, but if you mean there is no way to call run, use this in LDFLAGS when building RetroArch: -s EXPORTED_RUNTIME_METHODS="['callMain', 'FS']

Then do this in javascript to call run: Module.callMain(Module.arguments);

nenge123 commented 2 years ago

thanks,it can run in retroarch-ui!

Maybe there is something wrong with my game roms/bios, so "DQ1&2" is abnormal.

but: "Module._cmd_cheat_get_code" returns a numeric handle instead of the character I want.

I need to check this javascript now. Why can't it run in ios safari?

BinBashBanana commented 2 years ago

You need to use UTF8ToString to get the pointer value, like so:

UTF8ToString(Module._cmd_cheat_get_code(index));

this will give you the real cheat code.

Likewise for setting a cheat code:

Module._cmd_cheat_set_code(index, allocateUTF8("CODE"));
nenge123 commented 2 years ago

So that's it!