mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 23:14:37 +00:00
[ntsc-1.2] Import libleo from Decompollaborate/n64dd (#2104)
* Create stack.h for STACK/STACK_TOP * Import libleo from Decompollaborate/n64dd Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> * Use (unsigned) int when in mdebug * Apply suggestions from code review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Use && in leocmdex.c * Use proper names for character tables, revert sNonKanjiIndices * Fix incorrect OSMesg casts * Use LEO_ERROR_GOOD even where docs say 0 Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Remove "Presumably" comment * Whitespace * Remove redundant (debug-only) returns --------- Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
This commit is contained in:
parent
6f396e7cc8
commit
2152d1df2d
56 changed files with 4363 additions and 22 deletions
33
src/libleo/api/readwrite.c
Normal file
33
src/libleo/api/readwrite.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "global.h"
|
||||
#include "ultra64/leo.h"
|
||||
#include "ultra64/leoappli.h"
|
||||
#include "ultra64/leodrive.h"
|
||||
|
||||
s32 LeoReadWrite(LEOCmd* cmdBlock, s32 direction, u32 LBA, void* vAddr, u32 nLBAs, OSMesgQueue* mq) {
|
||||
if (!__leoActive) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (direction == OS_READ) {
|
||||
cmdBlock->header.command = 5;
|
||||
} else {
|
||||
cmdBlock->header.command = 6;
|
||||
}
|
||||
|
||||
cmdBlock->header.reserve1 = 0;
|
||||
|
||||
if (mq != NULL) {
|
||||
cmdBlock->header.control = 0x80;
|
||||
} else {
|
||||
cmdBlock->header.control = 0;
|
||||
}
|
||||
|
||||
cmdBlock->header.reserve3 = 0;
|
||||
cmdBlock->header.post = mq;
|
||||
cmdBlock->data.readWrite.lba = LBA;
|
||||
cmdBlock->data.readWrite.transferBlks = nLBAs;
|
||||
cmdBlock->data.readWrite.buffPtr = vAddr;
|
||||
|
||||
leoCommand(cmdBlock);
|
||||
return LEO_ERROR_GOOD;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue