1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-12-22 07:18:52 -05:00

Export a function to load a note from an array

This commit is contained in:
Raphael Assenat 2015-10-25 15:23:11 -04:00
parent 57a79cd113
commit c2944732ff
2 changed files with 7 additions and 4 deletions

View File

@ -363,7 +363,8 @@ static int __validate_region( uint8_t region )
* @retval -2 note inode out of bounds
* @retval -3 note region invalid
*/
static int __read_note( uint8_t *tnote, entry_structure_t *note )
//static int __read_note( uint8_t *tnote, entry_structure_t *note )
int mempak_parse_entry( const uint8_t *tnote, entry_structure_t *note )
{
if( !tnote || !note ) { return -1; }
@ -744,7 +745,7 @@ int get_mempak_entry( mempak_structure_t *mpk, int entry, entry_structure_t *ent
}
#endif
if( __read_note( data, entry_data ) )
if( mempak_parse_entry( data, entry_data ) )
{
/* Note is most likely empty, don't bother getting length */
return 0;
@ -1076,7 +1077,7 @@ int write_mempak_entry_data( mempak_structure_t *mpk, entry_structure_t *entry,
}
#endif
/* See if we can write to this note */
__read_note( tmp_data, &tmp_entry );
mempak_parse_entry( tmp_data, &tmp_entry );
if( tmp_entry.valid == 0 )
{
entry->entry_id = i;
@ -1161,7 +1162,7 @@ int delete_mempak_entry( mempak_structure_t *mpk, entry_structure_t *entry )
}
#endif
if( __read_note( data, &tmp_entry ) )
if( mempak_parse_entry( data, &tmp_entry ) )
{
/* Couldn't parse entry, can't be valid */
return -2;

View File

@ -71,6 +71,8 @@ int read_mempak_entry_data( mempak_structure_t *pak, entry_structure_t *entry, u
int write_mempak_entry_data( mempak_structure_t *pak, entry_structure_t *entry, uint8_t *data );
int delete_mempak_entry( mempak_structure_t *pak, entry_structure_t *entry );
int mempak_parse_entry( const uint8_t *tnote, entry_structure_t *note );
#ifdef __cplusplus
}
#endif