motor.c OK (#397)

* use motor in the spec

* import bss

* Delete viextendvstart.c

* rename functions

* move stuff and format

* remove globals.h and ultra64.h

* Update src/libultra/io/motor.c

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>

* add motor.h to padmgr

* fix

Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2021-11-06 00:29:56 -03:00
committed by GitHub
parent e70a8fbb99
commit 278ff4a4b3
12 changed files with 49 additions and 40 deletions
-5
View File
@@ -1,5 +0,0 @@
#include "global.h"
void osViExtendVStart(u32 a0) {
__additional_scanline = a0;
}
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "ultra64/motor.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_GetControllerBitmask.s")
+13 -8
View File
@@ -1,12 +1,16 @@
#include "ultra64.h"
#include "global.h"
#include "ultra64/motor.h"
#include "io/controller.h"
#include "functions.h"
#define BANK_ADDR 0x400
#define MOTOR_ID 0x80
OSPifRam osPifBuffers[MAXCONTROLLERS];
s32 __osPfsSelectBank(OSPfs* pfs, u8 bank);
s32 osSetRumble(OSPfs* pfs, u32 vibrate) {
s32 __osMotorAccess(OSPfs* pfs, u32 vibrate) {
s32 i;
s32 ret;
u8* buf = (u8*)&osPifBuffers[pfs->channel];
@@ -45,10 +49,11 @@ s32 osSetRumble(OSPfs* pfs, u32 vibrate) {
return ret;
}
void osSetUpMempakWrite(u32 channel, OSPifRam* buf) {
void _MakeMotorData(s32 channel, OSPifRam* buf) {
u8* bufptr = (u8*)buf;
__OSContRamReadFormat mempakwr;
u32 i;
s32 i;
mempakwr.dummy = 0xFF;
mempakwr.txsize = 0x23;
@@ -68,7 +73,7 @@ void osSetUpMempakWrite(u32 channel, OSPifRam* buf) {
*bufptr = 0xFE;
}
s32 osProbeRumblePak(OSMesgQueue* ctrlrqueue, OSPfs* pfs, u32 channel) {
s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel) {
s32 ret;
u8 sp24[BLOCKSIZE];
@@ -111,8 +116,8 @@ s32 osProbeRumblePak(OSMesgQueue* ctrlrqueue, OSPfs* pfs, u32 channel) {
if (sp24[BLOCKSIZE - 1] != MOTOR_ID) {
return 0xB;
}
if ((pfs->status & PFS_MOTOR_INITIALIZED) == 0) {
osSetUpMempakWrite(channel, &osPifBuffers[channel]);
if (!(pfs->status & PFS_MOTOR_INITIALIZED)) {
_MakeMotorData(channel, &osPifBuffers[channel]);
}
pfs->status = PFS_MOTOR_INITIALIZED;
-7
View File
@@ -1,7 +0,0 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/boot/rumblepak/osSetRumble.s")
#pragma GLOBAL_ASM("asm/non_matchings/boot/rumblepak/osSetUpMempakWrite.s")
#pragma GLOBAL_ASM("asm/non_matchings/boot/rumblepak/osProbeRumblePak.s")