-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add port to original Xbox using nxdk #1
base: master
Are you sure you want to change the base?
Conversation
#ifndef NXDK | ||
#include <stdlib.h> | ||
#else | ||
#define _MAX_PATH 200 //FIXME: Get real value for Xbox? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: This should be fixed upstream so we no longer need this different code-path
|
||
void __cdecl operator delete(void *ptr) { | ||
free(ptr); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: new
and delete
should be from libcxx. Why don't we seem to have those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires NXDK_CXX = y
in Makefile. Not fixed yet.
|
||
extern "C" { | ||
extern uint8_t* _fb; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: This works around a bug in nxdk video.h
memset(_fb, 0x00, fb_size); | ||
#define _PCRTC_START 0xFD600800 | ||
*(unsigned int*)(_PCRTC_START) = (unsigned int)_fb & 0x03FFFFFF; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: This works around a bug in nxdk video.h
#if defined(NXDK) | ||
// Set display mode (16bpp to save memory) | ||
//FIXME: Temporarily switched to 32bpp, as I got weird issues at 16bpp | ||
XVideoSetMode(640, 480, 32, REFRESH_DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: Check wether game works on all refresh rates? Also switch to 16bpp mode?
} else if (strcmp(name, "gamma") == 0) { | ||
g_system->setGamma(atof(value)); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: nxdk lacks atof
3e7f3ca
to
6c39619
Compare
resource.cpp screenshot.cpp sound.cpp staticres.cpp system_sdl2.cpp \ | ||
util.cpp video.cpp | ||
|
||
SCALERS := scaler_nearest.cpp #FIXME: scaler_xbr.cpp is broken in nxdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: The XBR scaler is broken; the linker will throw a warning and the result XBE will not launch. I assume cxbe can't handle files with dllexports?
I got a crash / hang after about 20 minutes. I'm not sure where or how it crashed. Could also be running out of memory or something? This needs more stress testing. |
I had a crash (or assert?) during the loadscreen. I previously got such crashes when my |
Suggestion for fs_win32.cpp char filePath[_MAX_PATH];
WIN32_FIND_DATAA de;
snprintf(filePath, sizeof(filePath), "%s\\*", dir);
HANDLE d = FindFirstFileA(filePath, &de);
if (d != INVALID_HANDLE_VALUE) {
BOOL found = TRUE;
- while (1) {
- if (de.cFileName[0] == '.') {
+ do
+ {
+ if (de.cFileName[0] == '.')
+ {
continue;
}
snprintf(filePath, sizeof(filePath), "%s\\%s", dir, de.cFileName);
if (de.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
listFiles(filePath);
- } else if (matchGameData(filePath)) {
- addFilePath(filePath);
}
- if(!FindNextFileA(d, &de)) {
- break;
+ else if (matchGameData(filePath)) {
+ addFilePath(filePath);
}
- }
- CloseHandle(d);
+ } while (FindNextFileA(d, &de) != 0);
+ FindClose(d);
}
} Previously with HANDLE d = FindFirstFileA(filePath, &de);
if (d != INVALID_HANDLE_VALUE) {
BOOL found = TRUE;
while (1) {
if (de.cFileName[0] == '.') {
continue;
}
// add files and skip to next one with
// FindNextFile
} when it encountered a filename starting with |
Thanks for the report. I'll eventually fix it (if nobody else does it before this file hits upstream - which hopefully happens). For now I have too many other projects to care for HODE. Our Xbox toolchain also needs bugs fixed before this is worth more of my time. I believe your code still wouldn't run the statement at the end of the I'm more tempted to rewrite this function with more nesting or a |
I'm confused about which revisions you used. Might have had a bad combination of submodules. Video delay For now, I assume that the video-capture device added the delay. It's highly unusual to have video lagging behind audio. The game has no room in memory to buffer video frames, and audio is only started when the animation also plays. If there was a latency issue we'd expect the audio to be lagging behind the video. Crash near end The early crash at the end of the video is unfortunate. I never had a crash this early. It might be something related to specific Xbox revisions, temperature, signal noise, uninitialized memory or something. |
break; | ||
} | ||
} | ||
CloseHandle(d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug; from MSDN:
When the search handle is no longer needed, close it by using the FindClose function, not CloseHandle.
CC @tuxuser
Rudimentary spite-port that was created after ModernVintageGamer announced that he'd be releasing HODE for Xbox built using the proprietary Xbox Development Kit that is (typically) illegally obtained.
In response, I challenged myself to create a port (within an hour or so) using the open-source and legally obtainable nxdk toolchain. In the end, it took about 3 hours (including some fine-tuning).
E:/UDATA/hode
(in case you want to move savegames around manually).Requires https://github.com/XboxDev/nxdk-sdl/pull/20.
(Last tested on XboxDev/nxdk@d42400d with XboxDev/nxdk-sdl@0ae8796)