Skip to content

Commit

Permalink
Further fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RossMeikleham committed Dec 2, 2023
1 parent 8d84007 commit a663bf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
4 changes: 4 additions & 0 deletions build/WatchOS/Plutoboy/Plutoboy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
51BF9A2C2B1B67A400C3DD1E /* get_time.c in Sources */ = {isa = PBXBuildFile; fileRef = 51BF9A2B2B1B67A400C3DD1E /* get_time.c */; };
910D340325DAF71D0008AA21 /* bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 910D340225DAF71D0008AA21 /* bg@2x.png */; };
910D341625DEFB7D0008AA21 /* PlutoboyScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 910D341525DEFB7D0008AA21 /* PlutoboyScene.swift */; };
9119A0002554729E0085D264 /* mbc3.c in Sources */ = {isa = PBXBuildFile; fileRef = 91199FEA2554729C0085D264 /* mbc3.c */; };
Expand Down Expand Up @@ -115,6 +116,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
51BF9A2B2B1B67A400C3DD1E /* get_time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = get_time.c; path = ../../../../../src/shared_libs/get_time.c; sourceTree = "<group>"; };
910D33F925DAE9B70008AA21 /* graphics_WatchOS_callbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = graphics_WatchOS_callbacks.h; path = ../../../../../src/shared_libs/WatchOS/graphics_WatchOS_callbacks.h; sourceTree = "<group>"; };
910D340225DAF71D0008AA21 /* bg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "bg@2x.png"; path = "Assets.xcassets/bg@2x.png"; sourceTree = "<group>"; };
910D341525DEFB7D0008AA21 /* PlutoboyScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlutoboyScene.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -288,6 +290,7 @@
9141927E253209CA0070AD3B /* c_src */ = {
isa = PBXGroup;
children = (
51BF9A2B2B1B67A400C3DD1E /* get_time.c */,
9178D96725F2A35F00CBBEFB /* files.h */,
915311CC25E84265003F9FCB /* sound_queue_WatchOS.cpp */,
915311CD25E84265003F9FCB /* sound_queue_WatchOS.h */,
Expand Down Expand Up @@ -536,6 +539,7 @@
9119A0002554729E0085D264 /* mbc3.c in Sources */,
9119A02D255472E40085D264 /* framerate_WatchOS.c in Sources */,
9119A0072554729E0085D264 /* mmm01.c in Sources */,
51BF9A2C2B1B67A400C3DD1E /* get_time.c in Sources */,
9119A01F255472C40085D264 /* Multi_Buffer.cpp in Sources */,
9119A0362554730C0085D264 /* files.m in Sources */,
9119A02B255472E40085D264 /* graphics_WatchOS.c in Sources */,
Expand Down
30 changes: 1 addition & 29 deletions src/platforms/3DS/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,6 @@ unsigned long load_SRAM(const char *file_path, unsigned char *data, unsigned lon
return count;
}

/* Given a memory location, buffer, and size of the cache, attempts to load save data from cache into the buffer.
* Returns the size of the cache if successful, returns 0 if unsuccessful.
* Buffer should be at minimum of size "MAX_SRAMS_SIZE" */
unsigned long load_SRAM_cached(unsigned char *cache_ptr, unsigned char *data, unsigned long size){

log_message(LOG_INFO, "Attempting to load SRAM from cache\n");
void* dest = memcpy(data, cache_ptr, size);
if(dest != NULL){
log_message(LOG_INFO, "%lu bytes successfully read from cache\n",size);
return size;
}
return 0;
}


/* Given a file_path, save data and the size of save data, attempts to
* save the data to the given file. Returns 1 if successful, 0 otherwise */
int save_SRAM(const char *file_path, const unsigned char *data, unsigned long size) {
Expand All @@ -104,17 +89,4 @@ int save_SRAM(const char *file_path, const unsigned char *data, unsigned long si

fclose(file);
return 1;
}

/* Given memory location, save data and the size of save data, attempts to
* save the data to a cache in ram. Used to improve 3DS emulation speed
* and lower the amount of taxing I/O writes. Returns 1 if successful, 0 otherwise */
int save_SRAM_cached(unsigned char *cache_ptr, unsigned char *data, unsigned long size){
log_message(LOG_INFO, "Attempting to write SRAM cache\n");
void* dest = memcpy(cache_ptr, data, size);
if(dest != NULL){
log_message(LOG_INFO, "%lu bytes successfully written to cache\n",size);
return size;
}
return 0;
}
}

0 comments on commit a663bf9

Please sign in to comment.