-
Notifications
You must be signed in to change notification settings - Fork 0
/
zxay_poke.c
42 lines (35 loc) · 871 Bytes
/
zxay_poke.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* AYE ZXAYEMUL metadata editor
* by Chris Young 2021, 2022
* https://www.unsatisfactorysoftware.co.uk
*/
/* ZXAY peek routines */
#include <stdlib.h>
#include <string.h>
#include "zxay_file.h"
#include "zxay_poke.h"
void zxay_poke(void *zxayemul, int type, char *newvalue)
{
struct zxay_file *zxay = (struct zxay_file *)zxayemul;
switch(type) {
case ZXAY_AUTHOR:
if(zxay->author) free(zxay->author);
zxay->author = strdup(newvalue);
break;
case ZXAY_MISC:
if(zxay->misc) free(zxay->misc);
zxay->misc = strdup(newvalue);
break;
default:
break;
}
}
void zxay_poke_track(void *zxayemul, int song, int type, char *newvalue)
{
struct zxay_file *zxay = (struct zxay_file *)zxayemul;
switch(type) {
case ZXAY_SONG_NAME:
if(zxay->songname[song]) free(zxay->songname[song]);
zxay->songname[song] = strdup(newvalue);
break;
}
}