Skip to content

Commit

Permalink
Fix NDS and files backup
Browse files Browse the repository at this point in the history
  • Loading branch information
Namaneo committed Aug 5, 2023
1 parent 1f41a9e commit 4db08d3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion cores/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ fetch-%:
@target=`pwd`/lib$*.a && \
name=`jq -r '."$*".repository // "$*"' cores.json` && \
owner=`jq -r '."$*".owner // "libretro"' cores.json` && \
branch=`jq -r '."$*".branch // "master"' cores.json` && \
echo Fetching $$name... && \
git -C $$name pull $(QUIET) || git clone https://github.com/$$owner/$$name.git $(QUIET)
git -C $$name pull $(QUIET) || git clone -b $$branch https://github.com/$$owner/$$name.git $(QUIET)

build-%: fetch-%
@target=`pwd`/lib$*.a && \
Expand Down
2 changes: 2 additions & 0 deletions cores/cores.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"desmume": {
"name": "DeSmuME",
"directory": "desmume/src/frontend/libretro",
"owner": "Namaneo",
"branch": "advsc_has-database",
"systems": [
{
"name": "Nintendo DS",
Expand Down
12 changes: 7 additions & 5 deletions ui/sources/pages/saves-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export const SavesPage = () => {
document.body.appendChild(a);

const files = []
// for (const save of saves)
// for (const path of save.paths)
// files.push(await Database.file(path));
for (const save of saves)
for (const path of save.paths)
files.push(new File([await Files.read(path)], path));

const blob = await Zip.compress(files);

Expand All @@ -66,8 +66,10 @@ export const SavesPage = () => {

fileInput.current.value = '';

// for (const file of files)
// await Database.add(file.name, file);
for (const file of files) {
const buffer = new Uint8Array(await file.arrayBuffer());
await Files.write(file.name, buffer);
}

setSaves(await Files.Saves.get());
}
Expand Down
4 changes: 2 additions & 2 deletions ui/sources/services/wasi.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const WASI_ENV = {
},
fd_read: (fd, iovs, iovs_len, nread) => {
if (fd < 3)
return __WASI_ERRNO_SUCCESS;
return __WASI_ERRNO_BADF;

const size = JUN.filesystem.size(JUN.fds[fd].path);
if (size == -1)
Expand Down Expand Up @@ -171,7 +171,7 @@ export const WASI_ENV = {
JUN.fds[fd].offset += Number(offset);
break;
case WHENCE_END:
JUN.fds[fd].offset = size - Number(offset);
JUN.fds[fd].offset = size + Number(offset);
break;
}

Expand Down

0 comments on commit 4db08d3

Please sign in to comment.