aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/n64
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/n64')
-rw-r--r--backends/platform/n64/framfs_save_manager.cpp3
-rw-r--r--backends/platform/n64/framfs_save_manager.h3
-rw-r--r--backends/platform/n64/nintendo64.cpp3
-rw-r--r--backends/platform/n64/osys_n64.h5
-rw-r--r--backends/platform/n64/osys_n64_base.cpp39
-rw-r--r--backends/platform/n64/osys_n64_events.cpp18
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp3
-rwxr-xr-x[-rw-r--r--]backends/platform/n64/pad_rom.sh0
-rw-r--r--backends/platform/n64/pakfs_save_manager.cpp3
-rw-r--r--backends/platform/n64/pakfs_save_manager.h3
-rw-r--r--backends/platform/n64/portdefs.h3
11 files changed, 31 insertions, 52 deletions
diff --git a/backends/platform/n64/framfs_save_manager.cpp b/backends/platform/n64/framfs_save_manager.cpp
index 053ed741b3..983b9aba8d 100644
--- a/backends/platform/n64/framfs_save_manager.cpp
+++ b/backends/platform/n64/framfs_save_manager.cpp
@@ -18,9 +18,6 @@
* 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$
- *
*/
#include <n64utils.h>
diff --git a/backends/platform/n64/framfs_save_manager.h b/backends/platform/n64/framfs_save_manager.h
index 376bdf1051..d50c17d85b 100644
--- a/backends/platform/n64/framfs_save_manager.h
+++ b/backends/platform/n64/framfs_save_manager.h
@@ -18,9 +18,6 @@
* 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$
- *
*/
#ifndef __FRAMFS_SAVE_MANAGER__
diff --git a/backends/platform/n64/nintendo64.cpp b/backends/platform/n64/nintendo64.cpp
index ff8e7485c9..3e811e73d2 100644
--- a/backends/platform/n64/nintendo64.cpp
+++ b/backends/platform/n64/nintendo64.cpp
@@ -18,9 +18,6 @@
* 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$
- *
*/
#include "osys_n64.h"
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 7a84de0449..8c0b34ce32 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -18,9 +18,6 @@
* 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$
- *
*/
#ifndef __OSYS_N64_H__
@@ -129,7 +126,7 @@ protected:
volatile int _mouseMaxX, _mouseMaxY;
int _mouseHotspotX, _mouseHotspotY;
- uint8 _controllerPort;
+ int8 _controllerPort;
int8 _mousePort;
bool _controllerHasRumble; // Gets enabled if rumble-pak is detected
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 232037899b..fb3b1dbd93 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -18,9 +18,6 @@
* 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$
- *
*/
#include <romfs.h>
@@ -32,6 +29,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 +89,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 +110,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 +124,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 +373,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 +382,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 +519,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 +531,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 +551,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) {
@@ -790,8 +789,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 +906,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.
diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp
index 22b9addbfb..2645cfea2a 100644
--- a/backends/platform/n64/osys_n64_events.cpp
+++ b/backends/platform/n64/osys_n64_events.cpp
@@ -18,9 +18,6 @@
* 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$
- *
*/
#include <math.h> // Needed for "tan()" function
@@ -94,8 +91,13 @@ void OSystem_N64::readControllerAnalogInput(void) {
// Read current controller status
controller_Read_Buttons(&_ctrlData);
- pad_analogX = (_ctrlData.c[_controllerPort].throttle >> 8) & 0xFF;
- pad_analogY = (_ctrlData.c[_controllerPort].throttle >> 0) & 0xFF;
+ pad_analogX = 0;
+ pad_analogY = 0;
+
+ if (_controllerPort >= 0) {
+ pad_analogX = (_ctrlData.c[_controllerPort].throttle >> 8) & 0xFF;
+ pad_analogY = (_ctrlData.c[_controllerPort].throttle >> 0) & 0xFF;
+ }
pad_mouseX = 0;
pad_mouseY = 0;
@@ -157,9 +159,11 @@ bool OSystem_N64::pollEvent(Common::Event &event) {
static uint16 oldButtons = 0; // old button data... used for button press/release
static uint16 oldMouseButtons = 0;
- uint16 newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller
+ uint16 newButtons = 0;
+ if (_controllerPort >= 0)
+ newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller
+
uint16 newMouseButtons = 0;
-
if (_mousePort >= 0)
newMouseButtons = _ctrlData.c[_mousePort].buttons;
diff --git a/backends/platform/n64/osys_n64_utilities.cpp b/backends/platform/n64/osys_n64_utilities.cpp
index 88a2970d7d..8d9f0471d3 100644
--- a/backends/platform/n64/osys_n64_utilities.cpp
+++ b/backends/platform/n64/osys_n64_utilities.cpp
@@ -18,9 +18,6 @@
* 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$
- *
*/
#include "osys_n64.h"
diff --git a/backends/platform/n64/pad_rom.sh b/backends/platform/n64/pad_rom.sh
index 085203306f..085203306f 100644..100755
--- a/backends/platform/n64/pad_rom.sh
+++ b/backends/platform/n64/pad_rom.sh
diff --git a/backends/platform/n64/pakfs_save_manager.cpp b/backends/platform/n64/pakfs_save_manager.cpp
index 25d82826e5..df9baa4d21 100644
--- a/backends/platform/n64/pakfs_save_manager.cpp
+++ b/backends/platform/n64/pakfs_save_manager.cpp
@@ -18,9 +18,6 @@
* 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$
- *
*/
#include <n64utils.h>
diff --git a/backends/platform/n64/pakfs_save_manager.h b/backends/platform/n64/pakfs_save_manager.h
index b0af464b3a..6987801294 100644
--- a/backends/platform/n64/pakfs_save_manager.h
+++ b/backends/platform/n64/pakfs_save_manager.h
@@ -18,9 +18,6 @@
* 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$
- *
*/
#ifndef __PAKFS_SAVE_MANAGER__
diff --git a/backends/platform/n64/portdefs.h b/backends/platform/n64/portdefs.h
index 9fd714ad9f..e62551355d 100644
--- a/backends/platform/n64/portdefs.h
+++ b/backends/platform/n64/portdefs.h
@@ -18,9 +18,6 @@
* 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$
- *
*/
#ifndef __N64_PORTDEFS__