···11+/*****************************************************************************
22+ * pce *
33+ *****************************************************************************/
44+55+/*****************************************************************************
66+ * File name: src/drivers/pri/pri-img-moof.h *
77+ * Created: 2022-10-02 by Hampa Hug <hampa@hampa.ch> *
88+ * Copyright: (C) 2022 Hampa Hug <hampa@hampa.ch> *
99+ *****************************************************************************/
1010+1111+/*****************************************************************************
1212+ * This program is free software. You can redistribute it and / or modify it *
1313+ * under the terms of the GNU General Public License version 2 as published *
1414+ * by the Free Software Foundation. *
1515+ * *
1616+ * This program is distributed in the hope that it will be useful, but *
1717+ * WITHOUT ANY WARRANTY, without even the implied warranty of *
1818+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
1919+ * Public License for more details. *
2020+ *****************************************************************************/
2121+2222+2323+#ifndef PCE_PRI_IMG_MOOF_H
2424+#define PCE_PRI_IMG_MOOF_H 1
2525+2626+2727+#include <drivers/pri/pri.h>
2828+2929+3030+pri_img_t *pri_load_moof (FILE *fp);
3131+3232+int pri_save_moof (FILE *fp, const pri_img_t *img);
3333+3434+int pri_probe_moof_fp (FILE *fp);
3535+int pri_probe_moof (const char *fname);
3636+3737+3838+#endif
+20-2
src/drivers/pri/pri-img.c
···55/*****************************************************************************
66 * File name: src/drivers/pri/pri-img.c *
77 * Created: 2012-01-31 by Hampa Hug <hampa@hampa.ch> *
88- * Copyright: (C) 2012-2019 Hampa Hug <hampa@hampa.ch> *
88+ * Copyright: (C) 2012-2022 Hampa Hug <hampa@hampa.ch> *
99 *****************************************************************************/
10101111/*****************************************************************************
···1515 * *
1616 * This program is distributed in the hope that it will be useful, but *
1717 * WITHOUT ANY WARRANTY, without even the implied warranty of *
1818- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
1818+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
1919 * Public License for more details. *
2020 *****************************************************************************/
2121···2525#include <string.h>
26262727#include "pri-img.h"
2828+#include "pri-img-moof.h"
2829#include "pri-img-pbit.h"
2930#include "pri-img-pri.h"
3031#include "pri-img-tc.h"
···232233 else if (strcasecmp (ext, ".woz") == 0) {
233234 return (PRI_FORMAT_WOZ);
234235 }
236236+ else if (strcasecmp (ext, ".moof") == 0) {
237237+ return (PRI_FORMAT_MOOF);
238238+ }
235239236240 return (PRI_FORMAT_NONE);
237241}
···269273 else if (strcasecmp (ext, ".woz") == 0) {
270274 return (PRI_FORMAT_WOZ);
271275 }
276276+ else if (strcasecmp (ext, ".moof") == 0) {
277277+ return (PRI_FORMAT_MOOF);
278278+ }
272279273280 return (PRI_FORMAT_PRI);
274281}
···281288 img = NULL;
282289283290 switch (type) {
291291+ case PRI_FORMAT_MOOF:
292292+ img = pri_load_moof (fp);
293293+ break;
294294+284295 case PRI_FORMAT_PBIT:
285296 img = pri_load_pbit (fp);
286297 break;
···322333int pri_img_save_fp (FILE *fp, const pri_img_t *img, unsigned type)
323334{
324335 switch (type) {
336336+ case PRI_FORMAT_MOOF:
337337+ return (pri_save_moof (fp, img));
338338+325339 case PRI_FORMAT_PBIT:
326340 return (pri_save_pbit (fp, img));
327341···372386373387 if (pri_probe_woz_fp (fp)) {
374388 return (PRI_FORMAT_WOZ);
389389+ }
390390+391391+ if (pri_probe_moof_fp (fp)) {
392392+ return (PRI_FORMAT_MOOF);
375393 }
376394377395 return (PRI_FORMAT_NONE);
+3-2
src/drivers/pri/pri-img.h
···55/*****************************************************************************
66 * File name: src/drivers/pri/pri-img.h *
77 * Created: 2012-01-31 by Hampa Hug <hampa@hampa.ch> *
88- * Copyright: (C) 2012-2019 Hampa Hug <hampa@hampa.ch> *
88+ * Copyright: (C) 2012-2022 Hampa Hug <hampa@hampa.ch> *
99 *****************************************************************************/
10101111/*****************************************************************************
···1515 * *
1616 * This program is distributed in the hope that it will be useful, but *
1717 * WITHOUT ANY WARRANTY, without even the implied warranty of *
1818- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
1818+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
1919 * Public License for more details. *
2020 *****************************************************************************/
2121···3434#define PRI_FORMAT_PRI 2
3535#define PRI_FORMAT_TC 3
3636#define PRI_FORMAT_WOZ 4
3737+#define PRI_FORMAT_MOOF 5
373838393940unsigned pri_get_uint16_be (const void *buf, unsigned idx);