mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-04-24 23:18:36 -05:00
Match ansi_files.c
This commit is contained in:
parent
56c756e0e4
commit
f89cde1934
|
|
@ -1,136 +0,0 @@
|
|||
.include "macros/function.inc"
|
||||
.include "include/ansi_files.inc"
|
||||
|
||||
|
||||
.extern __read_console
|
||||
.extern __write_console
|
||||
.extern __close_console
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
arm_func_start __flush_line_buffered_output_files
|
||||
__flush_line_buffered_output_files: ; 0x020D3F7C
|
||||
stmfd sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
|
||||
ldr r0, _020D4004 ; =0x02101490
|
||||
mov r4, #0
|
||||
mov r5, #1
|
||||
mov r8, r0
|
||||
mvn sb, #0
|
||||
mov r7, r4
|
||||
mov r6, #0x4c
|
||||
_020D3F9C:
|
||||
ldr r1, [r0, #4]
|
||||
mov r2, r1, lsl #0x16
|
||||
movs r2, r2, lsr #0x1d
|
||||
beq _020D3FDC
|
||||
mov r1, r1, lsl #0x19
|
||||
mov r1, r1, lsr #0x1e
|
||||
tst r1, #1
|
||||
beq _020D3FDC
|
||||
ldr r1, [r0, #8]
|
||||
mov r1, r1, lsl #0x1d
|
||||
mov r1, r1, lsr #0x1d
|
||||
cmp r1, #1
|
||||
bne _020D3FDC
|
||||
bl fflush
|
||||
cmp r0, #0
|
||||
movne r4, sb
|
||||
_020D3FDC:
|
||||
cmp r5, #3
|
||||
movge r0, r7
|
||||
bge _020D3FF4
|
||||
mul r0, r5, r6
|
||||
add r5, r5, #1
|
||||
add r0, r8, r0
|
||||
_020D3FF4:
|
||||
cmp r0, #0
|
||||
bne _020D3F9C
|
||||
mov r0, r4
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
|
||||
; .align 2, 0
|
||||
_020D4004: .word Unk_02101490
|
||||
arm_func_end __flush_line_buffered_output_files
|
||||
|
||||
arm_func_start __flush_all
|
||||
__flush_all: ; 0x020D4008
|
||||
stmfd sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
|
||||
ldr r0, _020D406C ; =0x02101490
|
||||
mov r4, #0
|
||||
mov r5, #1
|
||||
mov r8, r0
|
||||
mvn sb, #0
|
||||
mov r7, r4
|
||||
mov r6, #0x4c
|
||||
_020D4028:
|
||||
ldr r1, [r0, #4]
|
||||
mov r1, r1, lsl #0x16
|
||||
movs r1, r1, lsr #0x1d
|
||||
beq _020D4044
|
||||
bl fflush
|
||||
cmp r0, #0
|
||||
movne r4, sb
|
||||
_020D4044:
|
||||
cmp r5, #3
|
||||
movge r0, r7
|
||||
bge _020D405C
|
||||
mul r0, r5, r6
|
||||
add r5, r5, #1
|
||||
add r0, r8, r0
|
||||
_020D405C:
|
||||
cmp r0, #0
|
||||
bne _020D4028
|
||||
mov r0, r4
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
|
||||
; .align 2, 0
|
||||
_020D406C: .word Unk_02101490
|
||||
arm_func_end __flush_all
|
||||
|
||||
.data
|
||||
|
||||
|
||||
.global Unk_02101490
|
||||
Unk_02101490: ; 0x02101490
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0, 0x1C
|
||||
.word Unk_021D0C40
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0x20, 0x4
|
||||
.word Unk_021D0C40
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0x28, 0x14
|
||||
.word __read_console
|
||||
.word __write_console
|
||||
.word __close_console
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0x48, 0x20
|
||||
.word Unk_021D0B40
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0x6C, 0x4
|
||||
.word Unk_021D0B40
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0x74, 0x14
|
||||
.word __read_console
|
||||
.word __write_console
|
||||
.word __close_console
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0x94, 0x20
|
||||
.word Unk_021D0A40
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0xB8, 0x4
|
||||
.word Unk_021D0A40
|
||||
.incbin "incbin/arm9_data.bin", 0x27B0+0xC0, 0x14
|
||||
.word __read_console
|
||||
.word __write_console
|
||||
.word __close_console
|
||||
.word 0x0
|
||||
|
||||
|
||||
.bss
|
||||
|
||||
|
||||
.global Unk_021D0A40
|
||||
Unk_021D0A40: ; 0x021D0A40
|
||||
.space 0x100
|
||||
|
||||
.global Unk_021D0B40
|
||||
Unk_021D0B40: ; 0x021D0B40
|
||||
.space 0x100
|
||||
|
||||
.global Unk_021D0C40
|
||||
Unk_021D0C40: ; 0x021D0C40
|
||||
.space 0x100
|
||||
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
.extern Unk_021D0920
|
||||
.extern Unk_021D0944
|
||||
.extern Unk_021D0968
|
||||
.extern Unk_02101490
|
||||
.extern __files
|
||||
|
||||
|
||||
.text
|
||||
|
|
@ -80,7 +80,7 @@ _020D42F4:
|
|||
mov r0, r7
|
||||
ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc}
|
||||
; .align 2, 0
|
||||
_020D42FC: .word Unk_02101490
|
||||
_020D42FC: .word __files
|
||||
_020D4300: .word Unk_021D0968
|
||||
_020D4304: .word OSi_ThreadInfo
|
||||
_020D4308: .word Unk_021D0920
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
.extern Unk_021D0944
|
||||
.extern Unk_021D0968
|
||||
.extern Unk_021D0D40
|
||||
.extern Unk_02101490
|
||||
.extern __files
|
||||
|
||||
|
||||
.text
|
||||
|
|
@ -122,7 +122,7 @@ _020D4BD8:
|
|||
mov r0, r7
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
; .align 2, 0
|
||||
_020D4BE0: .word Unk_02101490
|
||||
_020D4BE0: .word __files
|
||||
_020D4BE4: .word 0x021014DC
|
||||
_020D4BE8: .word 0x02101528
|
||||
_020D4BEC: .word Unk_021D0968
|
||||
|
|
@ -343,7 +343,7 @@ _020D4EEC:
|
|||
mov r0, r7
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
|
||||
; .align 2, 0
|
||||
_020D4EF4: .word Unk_02101490
|
||||
_020D4EF4: .word __files
|
||||
_020D4EF8: .word 0x021014DC
|
||||
_020D4EFC: .word 0x02101528
|
||||
_020D4F00: .word Unk_021D0968
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
.public fflush
|
||||
190
lib/msl/src/MSL_C/ansi_files.c
Normal file
190
lib/msl/src/MSL_C/ansi_files.c
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
#include <ansi_params.h>
|
||||
#include <ansi_files.h>
|
||||
#include <console_io.h>
|
||||
#include <critical_regions.h>
|
||||
#include <file_io.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !_MSL_CONSOLE_SUPPORT && !_MSL_NULL_CONSOLE_ROUTINES
|
||||
#error Turning off _MSL_CONSOLE_SUPPORT requires _MSL_NULL_CONSOLE_ROUTINES!
|
||||
#endif
|
||||
|
||||
#if _MSL_FILE_CONSOLE_ROUTINES && !_MSL_FILE_CONSOLE_ROUTINES
|
||||
#error Turning on _MSL_FILE_CONSOLE_ROUTINES requires _MSL_FILE_CONSOLE_ROUTINES!
|
||||
#endif
|
||||
|
||||
#if _MSL_FILE_CONSOLE_ROUTINES && _MSL_NULL_CONSOLE_ROUTINES
|
||||
#error _MSL_FILE_CONSOLE_ROUTINES and _MSL_NULL_CONSOLE_ROUTINES cannot both be on at the same time!
|
||||
#endif
|
||||
|
||||
FILE __files[_STATIC_FILES] =
|
||||
{
|
||||
{
|
||||
0,
|
||||
{
|
||||
__must_exist,
|
||||
__read,
|
||||
console_buff_mode,
|
||||
__console_file,
|
||||
__unoriented,
|
||||
0
|
||||
},
|
||||
{
|
||||
__neutral,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdin_buff,
|
||||
console_buff_size,
|
||||
stdin_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
0,
|
||||
},
|
||||
|
||||
{
|
||||
1,
|
||||
{
|
||||
__must_exist,
|
||||
__write,
|
||||
console_buff_mode,
|
||||
__console_file,
|
||||
__unoriented,
|
||||
0
|
||||
},
|
||||
{
|
||||
__neutral,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdout_buff,
|
||||
console_buff_size,
|
||||
stdout_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
0,
|
||||
},
|
||||
|
||||
{
|
||||
2,
|
||||
{
|
||||
__must_exist,
|
||||
__write,
|
||||
_IONBF,
|
||||
__console_file,
|
||||
__unoriented,
|
||||
0
|
||||
},
|
||||
{
|
||||
__neutral,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stderr_buff,
|
||||
console_buff_size,
|
||||
stderr_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
0,
|
||||
}
|
||||
};
|
||||
|
||||
int _MSL_CDECL __flush_line_buffered_output_files (void)
|
||||
{
|
||||
int result = 0;
|
||||
FILE * p = &__files[0];
|
||||
|
||||
#if !_MSL_OS_DISK_FILE_SUPPORT
|
||||
int file_index = 1;
|
||||
#endif
|
||||
|
||||
while (p != NULL) {
|
||||
if (p->mode.file_kind != __closed_file &&
|
||||
(p->mode.buffer_mode & _IOLBF) &&
|
||||
p->state.io_state == __writing) {
|
||||
if (fflush(p)) {
|
||||
result = EOF;
|
||||
}
|
||||
}
|
||||
|
||||
#if _MSL_OS_DISK_FILE_SUPPORT
|
||||
p = p->next_file_struct;
|
||||
#else
|
||||
if (file_index < _STATIC_FILES) {
|
||||
p = &__files[file_index++];
|
||||
} else {
|
||||
p = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
int _MSL_CDECL __flush_all (void)
|
||||
{
|
||||
int result = 0;
|
||||
FILE * p = &__files[0];
|
||||
|
||||
#if !_MSL_OS_DISK_FILE_SUPPORT
|
||||
int file_index = 1;
|
||||
#endif
|
||||
|
||||
while (p != NULL) {
|
||||
if (p->mode.file_kind != __closed_file) {
|
||||
if (fflush(p)) {
|
||||
result = EOF;
|
||||
}
|
||||
}
|
||||
|
||||
#if _MSL_OS_DISK_FILE_SUPPORT
|
||||
p = p->next_file_struct;
|
||||
#else
|
||||
if (file_index < _STATIC_FILES) {
|
||||
p = &__files[file_index++];
|
||||
} else {
|
||||
p = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
2
main.lsf
2
main.lsf
|
|
@ -575,7 +575,7 @@ Static main
|
|||
Object lib/msl/asm/MSL_C/critical_region.o
|
||||
Object lib/msl/asm/MSL_C/math_arm.o
|
||||
Object lib/msl/src/MSL_C/alloc.o
|
||||
Object lib/msl/asm/MSL_C/ansi_files.o
|
||||
Object lib/msl/src/MSL_C/ansi_files.o
|
||||
Object lib/msl/asm/MSL_C/errno.o
|
||||
Object lib/msl/asm/MSL_C/arith.o
|
||||
Object lib/msl/asm/MSL_C/assert.o
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user