Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 2 additions & 6 deletions common/sbus/src/iop_sif2.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ int SIF2_RestartDma(void)
_sif2_xfer_chunk_size = (_sif2_xfer_size > SIF2_XFER_CHUNK_SIZE) ? SIF2_XFER_CHUNK_SIZE : _sif2_xfer_size;

bs = ((_sif2_xfer_chunk_size + 3) / 4);
if (bs > 32) {
bs = 32;
}
bs = (bs > 32) ? 32 : bs;

bc = (_sif2_xfer_chunk_size + ((bs * 4) - 1)) / (bs * 4);

Expand All @@ -86,9 +84,7 @@ int SIF2_set_dma(u32 addr, u32 size, u32 attr)
_sif2_xfer_addr = addr;
_sif2_xfer_size = size;

if (!(attr & PS2_DMA_FROM_MEM)) {
attr |= IOP_CHCR_30;
}
attr |= (!(attr & PS2_DMA_FROM_MEM)) ? IOP_CHCR_30 : 0;

_sif2_xfer_attr = IOP_CHCR_TR | attr;

Expand Down
5 changes: 1 addition & 4 deletions common/sbus/src/ps2_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ void _sif2_cmd_puts(SIF2_CmdPkt *cmd, void *param)

while (left > 0) {
int toget;
toget = left;
if (toget > sizeof(_dbg_cmd_dma_buf)) {
toget = sizeof(_dbg_cmd_dma_buf);
}
toget = (left > sizeof(_dbg_cmd_dma_buf)) ? sizeof(_dbg_cmd_dma_buf) : left;

// sio_printf("getting %d of %d bytes left\n", toget, left);

Expand Down
6 changes: 2 additions & 4 deletions ee/debug/src/scr_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,8 @@ void scr_vprintf(const char *format, va_list opt)

void scr_setXY(int x, int y)
{
if (x < MX && x >= 0)
X = x;
if (y < MY && y >= 0)
Y = y;
X = (x < MX && x >= 0) ? x : X;
Y = (y < MY && y >= 0) ? y : Y;
}

int scr_getX()
Expand Down
7 changes: 1 addition & 6 deletions ee/debug/src/screenshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,7 @@ int ps2_screenshot( void *pDest, unsigned int VramAdress, unsigned int x,

// Calc size depending on Psm

if( Psm == PS2SS_GSPSMCT16 )
uQSize = ((Width*Height*2)/16);
else if( Psm == PS2SS_GSPSMCT24 )
uQSize = ((Width*Height*3)/16);
else
uQSize = (Width*Height*4)/16;
uQSize = ( Psm == PS2SS_GSPSMCT16 ) ? ((Width*Height*2)/16) : (( Psm == PS2SS_GSPSMCT24 ) ? ((Width*Height*3)/16) : ((Width*Height*4)/16));

// Setup transfer texture back to memory

Expand Down
45 changes: 5 additions & 40 deletions ee/dma/src/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,7 @@ int dma_channel_initialize(int channel, void *handler, int flags)
dma_handler_id[channel] = AddDmacHandler(channel, handler, 0);

// Enable the channel interrupt.
if (flags & DMA_FLAG_INTERRUPTSAFE)
{
iEnableDmac(channel);
}
else
{
EnableDmac(channel);
}
((flags & DMA_FLAG_INTERRUPTSAFE) ? iEnableDmac : EnableDmac)(channel);

}

Expand Down Expand Up @@ -189,14 +182,7 @@ int dma_channel_send_chain(int channel, void *data, int data_size, int flags, in
// clear channel status
*DMA_REG_STAT = DMA_SET_STAT(1 << channel,0,0,0,0,0,0);

if (flags & DMA_FLAG_INTERRUPTSAFE)
{
iSyncDCache(data, (void *)((u8 *)data + (data_size<<4)));
}
else
{
SyncDCache(data, (void *)((u8 *)data + (data_size<<4)));
}
((flags & DMA_FLAG_INTERRUPTSAFE) ? iSyncDCache : SyncDCache)(data, (void *)((u8 *)data + (data_size<<4)));

// Set the size of the data, in quadwords.
*(vu32 *)dma_qwc[channel] = DMA_SET_QWC(0);
Expand Down Expand Up @@ -245,14 +231,7 @@ int dma_channel_send_normal(int channel, void *data, int qwc, int flags, int spr
*DMA_REG_STAT = DMA_SET_STAT(1 << channel,0,0,0,0,0,0);

// Not sure if this should be here.
if (flags & DMA_FLAG_INTERRUPTSAFE)
{
iSyncDCache(data, (void *)((u8 *)data + (qwc<<4)));
}
else
{
SyncDCache(data, (void *)((u8 *)data + (qwc<<4)));
}
((flags & DMA_FLAG_INTERRUPTSAFE) ? iSyncDCache : SyncDCache)(data, (void *)((u8 *)data + (qwc<<4)));

// Set the size of the data, in quadwords.
*(vu32 *)dma_qwc[channel] = DMA_SET_QWC(qwc);
Expand All @@ -274,14 +253,7 @@ int dma_channel_send_normal_ucab(int channel, void *data, int qwc, int flags)
*DMA_REG_STAT = DMA_SET_STAT(1 << channel,0,0,0,0,0,0);

// Not sure if this should be here.
if (flags & DMA_FLAG_INTERRUPTSAFE)
{
iSyncDCache(data, (void *)((u8 *)data + (qwc<<4)));
}
else
{
SyncDCache(data, (void *)((u8 *)data + (qwc<<4)));
}
((flags & DMA_FLAG_INTERRUPTSAFE) ? iSyncDCache : SyncDCache)(data, (void *)((u8 *)data + (qwc<<4)));

// Set the size of the data, in quadwords.
*(vu32 *)dma_qwc[channel] = DMA_SET_QWC(qwc);
Expand Down Expand Up @@ -368,14 +340,7 @@ int dma_channel_shutdown(int channel, int flags)
{

// Disable the channel.
if (flags & DMA_FLAG_INTERRUPTSAFE)
{
iDisableDmac(channel);
}
else
{
DisableDmac(channel);
}
((flags & DMA_FLAG_INTERRUPTSAFE) ? iDisableDmac : DisableDmac)(channel);

// Remove the handler.
RemoveDmacHandler(channel, dma_handler_id[channel]);
Expand Down
23 changes: 5 additions & 18 deletions ee/draw/src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,12 @@ qword_t *draw_setup_environment(qword_t *q, int context, framebuffer_t *frame, z
dtest.pass = DRAW_DISABLE;

// Enable or Disable ZBuffer
if (z->enable)
{
ztest.enable = DRAW_ENABLE;
ztest.method = z->method;
}
else
if (!z->enable)
{
z->mask = 1;
ztest.enable = DRAW_ENABLE;
ztest.method = ZTEST_METHOD_ALLPASS;
}
ztest.enable = DRAW_ENABLE;
ztest.method = z->enable ? z->method : ZTEST_METHOD_ALLPASS;

// Setup alpha blending
blend.color1 = BLEND_COLOR_SOURCE;
Expand Down Expand Up @@ -96,16 +91,8 @@ qword_t *draw_setup_environment(qword_t *q, int context, framebuffer_t *frame, z
PACK_GIFTAG(q,GS_SET_COLCLAMP(GS_ENABLE),GS_REG_COLCLAMP);
q++;
// Alpha Correction
if ((frame->psm == GS_PSM_16) || (frame->psm == GS_PSM_16S))
{
PACK_GIFTAG(q,GS_SET_FBA(ALPHA_CORRECT_RGBA16),GS_REG_FBA + context);
q++;
}
else
{
PACK_GIFTAG(q,GS_SET_FBA(ALPHA_CORRECT_RGBA32),GS_REG_FBA + context);
q++;
}
PACK_GIFTAG(q,GS_SET_FBA((((frame->psm == GS_PSM_16) || (frame->psm == GS_PSM_16S)) ? ALPHA_CORRECT_RGBA16 : ALPHA_CORRECT_RGBA32)),GS_REG_FBA + context);
q++;
// Texture wrapping/clamping
PACK_GIFTAG(q, GS_SET_CLAMP(wrap.horizontal,wrap.vertical,wrap.minu,
wrap.maxu,wrap.minv,wrap.maxv), GS_REG_CLAMP + context);
Expand Down
12 changes: 1 addition & 11 deletions ee/elf-loader2/src/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,7 @@ int elf_loader_is_elf_valid_for_loading(const void *buf, size_t buf_size)
ph_count += 1;
}
}
if ( !ph_count || ph_count > ELF_LOADER_MAX_PROGRAM_HEADERS )
{
return -21;
}
if ( !entrypoint_in_ph )
{
return -22;
}
if ( buf_size < highest_offset )
return -32;
return 0;
return ( !ph_count || ph_count > ELF_LOADER_MAX_PROGRAM_HEADERS ) ? -21 : (( !entrypoint_in_ph ) ? -22 : (( buf_size < highest_offset ) ? -32 : 0));
}

int elf_loader_exec_elf_prepare_loadinfo(elf_loader_execinfo_t *execinfo, const void *buf, size_t buf_size)
Expand Down
3 changes: 1 addition & 2 deletions ee/elf-loader2/src/elf_loader_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ void elf_loader_reader_read_elf_file(elf_loader_reader_info_t *info)
int ret;

ret = elf_loader_is_elf_ehdr_valid(ptr);
if ( ret )
ptr = info->m_alloc_callback(info->m_userdata, ptr, cur_alloc_block_size, 0);
ptr = ret ? info->m_alloc_callback(info->m_userdata, ptr, cur_alloc_block_size, 0) : ptr;
}
if ( ptr )
{
Expand Down
Loading
Loading