Skip to content

Commit

Permalink
- Typedef cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emukidid committed Aug 17, 2017
1 parent 012a4f7 commit 06fc814
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cube/patches/base/Stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void StreamUpdate()
void WritePCM48to32(u32 *buf_loc)
{
u32 CurBuf = (*(u8*)VAR_STREAM_CURBUF == 0) ? DECODED_BUFFER_0 : DECODED_BUFFER_1;
unsigned int j;
u32 j;
for(j = 0; j < SAMPLES_PER_BLOCK; j++)
{
*(u8*)VAR_AS_SAMPLECNT = *(u8*)VAR_AS_SAMPLECNT+1;
Expand All @@ -92,7 +92,7 @@ void WritePCM48to32(u32 *buf_loc)
void WritePCM48(u32 *buf_loc)
{
u32 CurBuf = (*(u8*)VAR_STREAM_CURBUF == 0) ? DECODED_BUFFER_0 : DECODED_BUFFER_1;
unsigned int j;
u32 j;
for(j = 0; j < SAMPLES_PER_BLOCK; j++)
{
write16INC(CurBuf, buf_loc, *(((s16*)VAR_AS_OUTL)+j));
Expand Down
10 changes: 6 additions & 4 deletions cube/patches/base/adp.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
// uses same algorithm as XA, apparently
// ADP decoder function by hcs, reversed from dtkmake (trkmake v1.4)

#include "../../reservedarea.h"
#include "common.h"

#define ONE_BLOCK_SIZE 32
#define SAMPLES_PER_BLOCK 28

short ADPDecodeSample( int bits, int q, long * hist1p, long * hist2p) {
short ADPDecodeSample( s32 bits, s32 q, long * hist1p, long * hist2p) {
long hist=0,cur;
long hist1=*hist1p,hist2=*hist2p;

Expand Down Expand Up @@ -53,12 +56,11 @@ short ADPDecodeSample( int bits, int q, long * hist1p, long * hist2p) {
}

// decode 32 bytes of input (28 samples), assume stereo
int ADPdecodebuffer(unsigned char *input, short *outl, short * outr, long *histl1, long *histl2, long *histr1, long *histr2) {
int i;
void ADPdecodebuffer(unsigned char *input, short *outl, short * outr, long *histl1, long *histl2, long *histr1, long *histr2) {
u32 i;
for( i = 0; i < SAMPLES_PER_BLOCK; i++ )
{
outl[i] = ADPDecodeSample( input[i + (ONE_BLOCK_SIZE - SAMPLES_PER_BLOCK)] & 0xf, input[0], histl1, histl2 );
outr[i] = ADPDecodeSample( input[i + (ONE_BLOCK_SIZE - SAMPLES_PER_BLOCK)] >> 4, input[1], histr1, histr2 );
}
return 0;
}
8 changes: 4 additions & 4 deletions cube/patches/base/common.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef _COMMON_H_

typedef volatile unsigned int vu32;
typedef unsigned int u32;
typedef int s32;
typedef unsigned long u32;
typedef long s32;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned char u8;
typedef volatile u32 vu32;

#define mftb(rval) ({unsigned long u; do { \
asm volatile ("mftbu %0" : "=r" (u)); \
Expand All @@ -22,7 +22,7 @@ typedef struct {
void do_read(void* dst, u32 len, u32 offset, u32 sector);
void device_frag_read(void* dst, u32 len, u32 offset);
void dcache_flush_icache_inv(void* dst, u32 len);
int ADPdecodebuffer(unsigned char *input, short *outl, short * outr, long *histl1, long *histl2, long *histr1, long *histr2);
void ADPdecodebuffer(unsigned char *input, short *outl, short * outr, long *histl1, long *histl2, long *histr1, long *histr2);
void StreamStartStream(u32 CurrentStart, u32 CurrentSize);
void StreamEndStream(void);
u32 process_queue(void* dst, u32 len, u32 offset, int readComplete);
Expand Down
4 changes: 0 additions & 4 deletions cube/patches/ide-exi/hddread.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define SECTOR_SIZE 512

typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;

#define _ata48bit *(u32*)VAR_TMP1

#define exi_freq (*(u32*)VAR_EXI_FREQ)
Expand Down
5 changes: 0 additions & 5 deletions cube/patches/usbgecko/usbgecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
#include "../../reservedarea.h"
#include "../base/common.h"

typedef unsigned int u32;
typedef int s32;
typedef unsigned short u16;
typedef unsigned char u8;

typedef struct {
unsigned int offset; // Offset in the file
unsigned int size; // size to read
Expand Down

0 comments on commit 06fc814

Please sign in to comment.