mirror of https://github.com/encounter/SDL.git
Add a way to avoid IOP reset
This commit is contained in:
parent
c5fe234d53
commit
d355ea9981
|
@ -16,6 +16,22 @@ cmake --build build
|
||||||
cmake --install build
|
cmake --install build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
|
||||||
|
So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
|
||||||
|
It could be something similar as:
|
||||||
|
```c
|
||||||
|
.....
|
||||||
|
|
||||||
|
SDL_PS2_SKIP_IOP_RESET();
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
.....
|
||||||
|
```
|
||||||
|
For a release binary is recommendable to reset the IOP always.
|
||||||
|
|
||||||
|
Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
|
||||||
|
|
||||||
## Getting PS2 Dev
|
## Getting PS2 Dev
|
||||||
[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
|
[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
|
||||||
|
@ -28,7 +44,4 @@ cmake --install build
|
||||||
## To Do
|
## To Do
|
||||||
- PS2 Screen Keyboard
|
- PS2 Screen Keyboard
|
||||||
- Dialogs
|
- Dialogs
|
||||||
- Audio
|
|
||||||
- Video
|
|
||||||
- Controllers
|
|
||||||
- Others
|
- Others
|
|
@ -104,6 +104,10 @@
|
||||||
#elif defined(__PS2__)
|
#elif defined(__PS2__)
|
||||||
#define SDL_MAIN_AVAILABLE
|
#define SDL_MAIN_AVAILABLE
|
||||||
|
|
||||||
|
#define SDL_PS2_SKIP_IOP_RESET() \
|
||||||
|
void reset_IOP(); \
|
||||||
|
void reset_IOP() {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* SDL_MAIN_HANDLED */
|
#endif /* SDL_MAIN_HANDLED */
|
||||||
|
|
||||||
|
|
|
@ -19,23 +19,25 @@
|
||||||
#include <sbv_patches.h>
|
#include <sbv_patches.h>
|
||||||
#include <ps2_fileXio_driver.h>
|
#include <ps2_fileXio_driver.h>
|
||||||
#include <ps2_memcard_driver.h>
|
#include <ps2_memcard_driver.h>
|
||||||
|
#include <ps2_usb_driver.h>
|
||||||
|
|
||||||
#ifdef main
|
#ifdef main
|
||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
__attribute__((weak))
|
||||||
|
void reset_IOP() {
|
||||||
|
SifInitRpc(0);
|
||||||
|
while(!SifIopReset(NULL, 0)){};
|
||||||
|
while(!SifIopSync()){};
|
||||||
|
}
|
||||||
|
|
||||||
static void prepare_IOP()
|
static void prepare_IOP()
|
||||||
{
|
{
|
||||||
|
reset_IOP();
|
||||||
SifInitRpc(0);
|
SifInitRpc(0);
|
||||||
// #if !defined(DEBUG) || defined(BUILD_FOR_PCSX2)
|
sbv_patch_enable_lmb();
|
||||||
/* Comment this line if you don't wanna debug the output */
|
sbv_patch_disable_prefix_check();
|
||||||
while(!SifIopReset(NULL, 0)){};
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
while(!SifIopSync()){};
|
|
||||||
SifInitRpc(0);
|
|
||||||
sbv_patch_enable_lmb();
|
|
||||||
sbv_patch_disable_prefix_check();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_drivers() {
|
static void init_drivers() {
|
||||||
|
@ -52,18 +54,17 @@ static void deinit_drivers() {
|
||||||
|
|
||||||
static void waitUntilDeviceIsReady(char *path)
|
static void waitUntilDeviceIsReady(char *path)
|
||||||
{
|
{
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int retries = 50;
|
int retries = 50;
|
||||||
|
|
||||||
while(ret != 0 && retries > 0)
|
while(ret != 0 && retries > 0) {
|
||||||
{
|
ret = stat(path, &buffer);
|
||||||
ret = stat(path, &buffer);
|
/* Wait untill the device is ready */
|
||||||
/* Wait untill the device is ready */
|
nopdelay();
|
||||||
nopdelay();
|
|
||||||
|
|
||||||
retries--;
|
retries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -84,6 +85,6 @@ int main(int argc, char *argv[])
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _EE */
|
#endif /* _PS2 */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
Loading…
Reference in New Issue