Skip to content
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

Fix rumble + ifdefs + rumble documentation #594

Open
wants to merge 17 commits into
base: develop/2.4.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions bin/title_screen_bg.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ const Texture *const game_over_texture_table[] = {
title_texture_game_over_0, title_texture_game_over_1, title_texture_game_over_2, title_texture_game_over_3,
};

UNUSED static const u64 title_screen_bg_unused_0 = 0;

#ifdef GODDARD_EASTER_EGG
const Gfx title_screen_bg_dl_face_easter_egg_begin[] = {
gsDPPipeSync(),
Expand All @@ -143,7 +141,7 @@ const Gfx title_screen_bg_dl_face_easter_egg_end[] = {
};
#endif

#if defined(VERSION_SH)
#ifdef ENABLE_RUMBLE
ALIGNED8 static const Texture title_texture_rumble_pak[] = {
#include "textures/title_screen_bg/title_screen_bg.06648.rgba16.inc.c"
};
Expand Down
3 changes: 1 addition & 2 deletions include/config/config_rom.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

/**
* Enables Rumble Pak Support.
* Currently not recommended, as it may cause random crashes.
*/
// #define ENABLE_RUMBLE (1 || VERSION_SH)
#define ENABLE_RUMBLE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this should be disabled by default, or if it is safe to always leave on, the comment two lines up should be modified/deleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the comment. I think it should be on by default since it's never crashed in any of my testing with these changes. I think that comment was about the old PJ64 crash from around 2 years ago.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not totally sure about it being left on even if it doesnt cause too much instability just because its extra code being added and most people won't care about it, and we can't be totally certain its not unstable


/**
* The maximum number of supported players/controllers. 1-4.
Expand Down
35 changes: 19 additions & 16 deletions include/ique/PR/os_motor.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.

$RCSfile: os_motor.h,v $
$Revision: 1.1.1.1 $
$Date: 2002/05/02 03:28:25 $
*---------------------------------------------------------------------*/

#ifndef _OS_MOTOR_H_
#define _OS_MOTOR_H_
#define _OS_MOTOR_H_

#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#endif /* _LANGUAGE_C_PLUS_PLUS */

#include <PR/ultratypes.h>
#include "os_message.h"
Expand Down Expand Up @@ -61,23 +61,26 @@ extern "C" {

/* Rumble PAK interface */

extern s32 osMotorInit(OSMesgQueue *mq, OSPfs *pfs, int controller_no);
#if 1
#define MOTOR_START 1
#define MOTOR_STOP 0
#define osMotorStart(x) __osMotorAccess((x), MOTOR_START)
#define osMotorStop(x) __osMotorAccess((x), MOTOR_STOP)
extern s32 __osMotorAccess(OSPfs *pfs, s32 flag);
#else
extern s32 osMotorStop( OSPfs *pfs);
extern s32 osMotorStart(OSPfs *pfs);
#endif
extern s32 osMotorInit( OSMesgQueue *mq, OSPfs *pfs, int controller_no);
extern s32 osMotorInitEx(OSMesgQueue *mq, OSPfs *pfs, int controller_no);
#define MOTOR_MASK_N64 0b01
#define MOTOR_MASK_GCN 0b11
enum OSMotorOP {
MOTOR_STOP,
MOTOR_START,
MOTOR_STOP_HARD, // GCN only.
};
#define osMotorStopHard(x) __osMotorAccessEx((x), MOTOR_STOP_HARD)
#define osMotorStart(x) __osMotorAccessEx((x), MOTOR_START)
#define osMotorStop(x) __osMotorAccessEx((x), MOTOR_STOP)
extern s32 __osMotorAccess( OSPfs *pfs, s32 flag);
extern s32 __osMotorAccessEx(OSPfs *pfs, s32 flag);


#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */

#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _LANGUAGE_C_PLUS_PLUS */

#endif /* !_OS_MOTOR_H_ */
117 changes: 60 additions & 57 deletions include/ique/PR/os_pfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@

/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)

$RCSfile: os_pfs.h,v $
$Revision: 1.1.1.1 $
$Date: 2002/05/02 03:28:25 $
*---------------------------------------------------------------------*/

#ifndef _OS_PFS_H_
#define _OS_PFS_H_
#define _OS_PFS_H_

#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#endif /* _LANGUAGE_C_PLUS_PLUS */

#include <PR/ultratypes.h>
#include "os_message.h"
Expand All @@ -50,28 +50,28 @@ extern "C" {
* Structure for file system
*/
typedef struct {
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
} OSPfs;
/*0x00*/ int status;
/*0x04*/ OSMesgQueue *queue;
/*0x08*/ int channel;
/*0x0C*/ u8 id[32];
/*0x2C*/ u8 label[32];
/*0x4C*/ int version;
/*0x50*/ int dir_size;
/*0x54*/ int inode_table; /* block location */
/*0x58*/ int minode_table; /* mirrioring inode_table */
/*0x5C*/ int dir_table; /* block location */
/*0x60*/ int inode_start_page; /* page # */
/*0x64*/ u8 banks;
/*0x65*/ u8 activebank;
} OSPfs; /*0x68*/

typedef struct {
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
} OSPfsState;
/*0x00*/ u32 file_size; /* bytes */
/*0x04*/ u32 game_code;
/*0x08*/ u16 company_code;
/*0x0A*/ char ext_name[4];
/*0x0E*/ char game_name[16];
} OSPfsState; /*0x20*/


#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
Expand All @@ -83,45 +83,48 @@ typedef struct {
*/

/* File System size */
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8) // 0x0002
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 0xFF) // 0x0000

#define PFS_FILE_NAME_LEN 16
#define PFS_FILE_EXT_LEN 4
#define BLOCKSIZE 32 /* bytes */
#define PFS_ONE_PAGE 8 /* blocks */
#define PFS_MAX_BANKS 62
#define PFS_FILE_NAME_LEN sizeof(((OSPfsState*)0)->game_name) // 16
#define PFS_FILE_EXT_LEN sizeof(((OSPfsState*)0)->ext_name ) // 4
#define BLOCKSIZE 32 /* bytes */
#define PFS_ONE_PAGE 8 /* blocks */
#define PFS_MAX_BANKS 62

/* File System flag */

#define PFS_READ 0
#define PFS_WRITE 1
#define PFS_CREATE 2
enum OSPfsFlag {
PFS_READ,
PFS_WRITE,
PFS_CREATE,
};

/* File System status */
#define PFS_INITIALIZED 0x1
#define PFS_CORRUPTED 0x2 /* File system was corrupted */
#define PFS_ID_BROKEN 0x4
#define PFS_MOTOR_INITIALIZED 0x8
#define PFS_GBPAK_INITIALIZED 0x10
#define PFS_STATUS_NONE 0x00
#define PFS_INITIALIZED (1 << 0) // 0x01
#define PFS_CORRUPTED (1 << 1) // 0x02 /* File system was corrupted */
#define PFS_ID_BROKEN (1 << 2) // 0x04
#define PFS_MOTOR_INITIALIZED (1 << 3) // 0x08
#define PFS_GBPAK_INITIALIZED (1 << 4) // 0x10

/* File System error number */

#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */
#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */
/* different one */
#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */
#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/
#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/
#define PFS_DATA_FULL 7 /* no free pages on ram pack */
#define PFS_DIR_FULL 8 /* no free directories on ram pack*/
#define PFS_ERR_EXIST 9 /* file exists */
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
#define PFS_ERR_DEVICE 11 /* wrong device type*/
#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */
#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */
enum OSPfsError {
PFS_ERR_SUCCESS, /* no error */
PFS_ERR_NOPACK, /* no memory card is plugged or */
PFS_ERR_NEW_PACK, /* ram pack has been changed to a different one */
PFS_ERR_INCONSISTENT, /* need to run Pfschecker */
PFS_ERR_CONTRFAIL, /* CONT_OVERRUN_ERROR */
PFS_ERR_INVALID, /* invalid parameter or file not exist */
PFS_ERR_BAD_DATA, /* the data read from pack are bad */
PFS_DATA_FULL, /* no free pages on ram pack */
PFS_DIR_FULL, /* no free directories on ram pack */
PFS_ERR_EXIST, /* file exists */
PFS_ERR_ID_FATAL, /* dead ram pack */
PFS_ERR_DEVICE, /* wrong device type */
PFS_ERR_NO_GBCART, /* no gb cartridge (64GB-PAK) */
PFS_ERR_NEW_GBCART, /* gb cartridge may be changed */
};


#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
Expand Down Expand Up @@ -165,10 +168,10 @@ extern s32 osPfsFreeBlocks( OSPfs *pfs, s32 *bytes_not_used);
extern s32 osPfsNumFiles( OSPfs *pfs, s32 *max_files, s32 *files_used);


#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */

#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _LANGUAGE_C_PLUS_PLUS */

#endif /* !_OS_PFS_H_ */
23 changes: 14 additions & 9 deletions include/ique/PR/rcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,29 @@ The Indy development board use cartridge domain 1:
* 1FC00000 +-------+-----------------+-----+
*
*/
#define PIF_ROM_SIZE 0x07C0
#define PIF_ROM_START 0x1FC00000
#define PIF_ROM_END 0x1FC007BF
#define PIF_RAM_START 0x1FC007C0
#define PIF_RAM_END 0x1FC007FF
#define PIF_ROM_END (PIF_ROM_START + PIF_ROM_SIZE - 1) /* 0x1FC007BF */

#define PIF_RAM_SIZE 0x0040
#define PIF_RAM_START (PIF_ROM_END + 1 ) /* 0x1FC007C0 */
#define PIF_RAM_END (PIF_RAM_START + PIF_RAM_SIZE - 1) /* 0x1FC007FF */


/*************************************************************************
* Controller channel
* Controller channel
* Each game controller channel has 4 error bits that are defined in bit 6-7 of
* the Rx and Tx data size area bytes. Programmers need to clear these bits
* when setting the Tx/Rx size area values for a channel
*/
#define CHNL_ERR_NORESP 0x80 /* Bit 7 (Rx): No response error */
#define CHNL_ERR_OVERRUN 0x40 /* Bit 6 (Rx): Overrun error */
#define CHNL_ERR_FRAME 0x80 /* Bit 7 (Tx): Frame error */
#define CHNL_ERR_COLLISION 0x40 /* Bit 6 (Tx): Collision error */
#define CHNL_ERR_SUCCESS 0x00

#define CHNL_ERR_NORESP (0b1 << 7) /* 0x80: Bit 7 (Rx): No response error */
#define CHNL_ERR_OVERRUN (0b1 << 6) /* 0x40: Bit 6 (Rx): Overrun error */
#define CHNL_ERR_FRAME (0b1 << 7) /* 0x80: Bit 7 (Tx): Frame error */
#define CHNL_ERR_COLLISION (0b1 << 6) /* 0x40: Bit 6 (Tx): Collision error */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use 1 instead of 0b1 for these (last one's probably fine though)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed


#define CHNL_ERR_MASK 0xC0 /* Bit 6-7: channel errors */
#define CHNL_ERR_MASK (0b11 << 6) /* 0xC0: Bit 6-7: channel errors */


/*************************************************************************
Expand Down
33 changes: 17 additions & 16 deletions include/n64/PR/os_motor.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think we shouldn't be touching any of the include/n64/PR/ files with any formatting changes whatsoever, unless they revolve around code actually written by us.

$RCSfile: os_motor.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:15 $
*---------------------------------------------------------------------*/

#ifndef _OS_MOTOR_H_
#define _OS_MOTOR_H_
#define _OS_MOTOR_H_

#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#endif /* _LANGUAGE_C_PLUS_PLUS */

#include <PR/ultratypes.h>
#include "os_message.h"
Expand Down Expand Up @@ -61,25 +61,26 @@ extern "C" {

/* Rumble PAK interface */

extern s32 osMotorInit(OSMesgQueue *mq, OSPfs *pfs, int controller_no);
extern s32 osMotorInit( OSMesgQueue *mq, OSPfs *pfs, int controller_no);
extern s32 osMotorInitEx(OSMesgQueue *mq, OSPfs *pfs, int controller_no);
#if 1
#define MOTOR_START 1
#define MOTOR_STOP 0
#define osMotorStart(x) __osMotorAccessEx((x), MOTOR_START)
#define osMotorStop(x) __osMotorAccessEx((x), MOTOR_STOP)
extern s32 __osMotorAccess(OSPfs *pfs, s32 flag);
#define MOTOR_MASK_N64 0b01
#define MOTOR_MASK_GCN 0b11
enum OSMotorOP {
MOTOR_STOP,
MOTOR_START,
MOTOR_STOP_HARD, // GCN only.
};
#define osMotorStopHard(x) __osMotorAccessEx((x), MOTOR_STOP_HARD)
#define osMotorStart(x) __osMotorAccessEx((x), MOTOR_START)
#define osMotorStop(x) __osMotorAccessEx((x), MOTOR_STOP)
extern s32 __osMotorAccess( OSPfs *pfs, s32 flag);
extern s32 __osMotorAccessEx(OSPfs *pfs, s32 flag);
#else
extern s32 osMotorStop( OSPfs *pfs);
extern s32 osMotorStart(OSPfs *pfs);
#endif


#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */

#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _LANGUAGE_C_PLUS_PLUS */

#endif /* !_OS_MOTOR_H_ */
Loading