-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from shelhamer/ale-latest
Update ALE for ROM fixes and snapshot/restore of state
- Loading branch information
Showing
50 changed files
with
720 additions
and
434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
//all code is currently in the .h file | ||
#include "ale_c_wrapper.h" | ||
|
||
#include <cstring> | ||
#include <string> | ||
#include <stdexcept> | ||
|
||
void encodeState(ALEState *state, char *buf, int buf_len) { | ||
std::string str = state->serialize(); | ||
|
||
if (buf_len < int(str.length())) { | ||
throw new std::runtime_error("Buffer is not big enough to hold serialized ALEState. Please use encodeStateLen to determine the correct buffer size"); | ||
} | ||
|
||
memcpy(buf, str.data(), str.length()); | ||
} | ||
|
||
int encodeStateLen(ALEState *state) { | ||
return state->serialize().length(); | ||
} | ||
|
||
ALEState *decodeState(const char *serialized, int len) { | ||
std::string str(serialized, len); | ||
|
||
return new ALEState(str); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.