diff options
Diffstat (limited to 'backends/platform/n64/osys_n64_base.cpp')
-rw-r--r-- | backends/platform/n64/osys_n64_base.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index 54eab0fd52..094bb839d3 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -18,11 +18,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ +#define FORBIDDEN_SYMBOL_ALLOW_ALL + #include <romfs.h> #include <malloc.h> // Required for memalign @@ -32,6 +31,8 @@ #include "framfs_save_manager.h" #include "backends/fs/n64/n64-fs-factory.h" +typedef unsigned long long uint64; + extern uint8 _romfs; // Defined by linker (used to calculate position of romfs image) inline uint16 colRGB888toBGR555(byte r, byte g, byte b); @@ -90,9 +91,9 @@ OSystem_N64::OSystem_N64() { _shakeOffset = 0; // Allocate memory for offscreen buffers - _offscreen_hic = (uint16*)memalign(8, _screenWidth * _screenHeight * 2); - _offscreen_pal = (uint8*)memalign(8, _screenWidth * _screenHeight); - _overlayBuffer = (uint16*)memalign(8, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); + _offscreen_hic = (uint16 *)memalign(8, _screenWidth * _screenHeight * 2); + _offscreen_pal = (uint8 *)memalign(8, _screenWidth * _screenHeight); + _overlayBuffer = (uint16 *)memalign(8, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); _cursor_pal = NULL; _cursor_hic = NULL; @@ -111,9 +112,9 @@ OSystem_N64::OSystem_N64() { _graphicMode = OVERS_NTSC_340X240; // Clear palette array - _screenPalette = (uint16*)memalign(8, 256 * sizeof(uint16)); + _screenPalette = (uint16 *)memalign(8, 256 * sizeof(uint16)); #ifndef N64_EXTREME_MEMORY_SAVING - _screenExactPalette = (uint8*)memalign(8, 256 * 3); + _screenExactPalette = (uint8 *)memalign(8, 256 * 3); memset(_screenExactPalette, 0, 256 * 3); #endif memset(_screenPalette, 0, 256 * sizeof(uint16)); @@ -125,7 +126,7 @@ OSystem_N64::OSystem_N64() { _audioEnabled = false; // Initialize ROMFS access interface - initRomFSmanager((uint8*)(((uint32)&_romfs + (uint32)0xc00) | (uint32)0xB0000000)); + initRomFSmanager((uint8 *)(((uint32)&_romfs + (uint32)0xc00) | (uint32)0xB0000000)); _mouseVisible = false; @@ -374,7 +375,7 @@ void OSystem_N64::rebuildOffscreenGameBuffer(void) { for (int h = 0; h < _gameHeight; h++) { for (int w = 0; w < _gameWidth; w += 4) { - four_col_pal = *(uint32*)(_offscreen_pal + ((h * _screenWidth) + w)); + four_col_pal = *(uint32 *)(_offscreen_pal + ((h * _screenWidth) + w)); four_col_hi = 0; four_col_hi |= (uint64)_screenPalette[((four_col_pal >> 24) & 0xFF)] << 48; @@ -383,7 +384,7 @@ void OSystem_N64::rebuildOffscreenGameBuffer(void) { four_col_hi |= (uint64)_screenPalette[((four_col_pal >> 0) & 0xFF)] << 0; // Save the converted pixels into hicolor buffer - *(uint64*)((_offscreen_hic) + (h * _screenWidth) + w) = four_col_hi; + *(uint64 *)((_offscreen_hic) + (h * _screenWidth) + w) = four_col_hi; } } } @@ -520,7 +521,7 @@ void OSystem_N64::updateScreen() { // Obtain the framebuffer while (!(_dc = lockDisplay())); - uint16 *overlay_framebuffer = (uint16*)_dc->conf.framebuffer; // Current screen framebuffer + uint16 *overlay_framebuffer = (uint16 *)_dc->conf.framebuffer; // Current screen framebuffer uint16 *game_framebuffer = overlay_framebuffer + (_frameBufferWidth * skip_lines * 2); // Skip some lines to center the image vertically uint16 currentHeight, currentWidth; @@ -532,8 +533,8 @@ void OSystem_N64::updateScreen() { tmpDst = game_framebuffer; tmpSrc = _offscreen_hic + (_shakeOffset * _screenWidth); for (currentHeight = _shakeOffset; currentHeight < _gameHeight; currentHeight++) { - uint64 *game_dest = (uint64*)(tmpDst + skip_pixels + _offscrPixels); - uint64 *game_src = (uint64*)tmpSrc; + uint64 *game_dest = (uint64 *)(tmpDst + skip_pixels + _offscrPixels); + uint64 *game_src = (uint64 *)tmpSrc; // With uint64 we copy 4 pixels at a time for (currentWidth = 0; currentWidth < _gameWidth; currentWidth += 4) { @@ -552,8 +553,8 @@ void OSystem_N64::updateScreen() { tmpDst = overlay_framebuffer; tmpSrc = _overlayBuffer; for (currentHeight = 0; currentHeight < _overlayHeight; currentHeight++) { - uint64 *over_dest = (uint64*)(tmpDst + _offscrPixels); - uint64 *over_src = (uint64*)tmpSrc; + uint64 *over_dest = (uint64 *)(tmpDst + _offscrPixels); + uint64 *over_src = (uint64 *)tmpSrc; // Copy 4 pixels at a time for (currentWidth = 0; currentWidth < _overlayWidth; currentWidth += 4) { @@ -610,7 +611,7 @@ Graphics::Surface *OSystem_N64::lockScreen() { _framebuffer.w = _gameWidth; _framebuffer.h = _gameHeight; _framebuffer.pitch = _screenWidth; - _framebuffer.bytesPerPixel = 1; + _framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); return &_framebuffer; } @@ -790,8 +791,8 @@ void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, } if (!_cursor_pal) { - _cursor_pal = (uint8*)malloc(w * h); - _cursor_hic = (uint16*)malloc(w * h * sizeof(uint16)); + _cursor_pal = (uint8 *)malloc(w * h); + _cursor_hic = (uint16 *)malloc(w * h * sizeof(uint16)); } _cursorWidth = w; @@ -907,10 +908,10 @@ void OSystem_N64::setupMixer(void) { /* Check all controller ports for a compatible input adapter. */ void OSystem_N64::detectControllers(void) { - controller_data_status *ctrl_status = (controller_data_status*)memalign(8, sizeof(controller_data_status)); + controller_data_status *ctrl_status = (controller_data_status *)memalign(8, sizeof(controller_data_status)); controller_Read_Status(ctrl_status); - _controllerPort = 0; // Use first controller as default + _controllerPort = -1; // Default no controller _mousePort = -1; // Default no mouse for (int8 ctrl_port = 3; ctrl_port >= 0; ctrl_port--) { // Found a standard pad, use this by default. |