From 09d71bdde77c5fea9d26120f9f97ac0c6a3f7471 Mon Sep 17 00:00:00 2001 From: dborth Date: Thu, 8 Jan 2009 07:21:34 +0000 Subject: [PATCH] update VBA structure to match new VBA-M structure --- source/vba/{ => agb}/CheatSearch.cpp | 0 source/vba/{ => agb}/CheatSearch.h | 0 source/vba/{ => agb}/Cheats.cpp | 0 source/vba/{ => agb}/Cheats.h | 0 source/vba/{ => agb}/EEprom.cpp | 0 source/vba/{ => agb}/EEprom.h | 0 source/vba/{ => agb}/Flash.cpp | 0 source/vba/{ => agb}/Flash.h | 0 source/vba/{ => agb}/Globals.cpp | 0 source/vba/{ => agb}/Globals.h | 0 source/vba/{ => agb}/Mode0.cpp | 0 source/vba/{ => agb}/Mode1.cpp | 0 source/vba/{ => agb}/Mode2.cpp | 0 source/vba/{ => agb}/Mode3.cpp | 0 source/vba/{ => agb}/Mode4.cpp | 0 source/vba/{ => agb}/Mode5.cpp | 0 source/vba/{ => agb}/RTC.cpp | 0 source/vba/{ => agb}/RTC.h | 0 source/vba/{ => agb}/Sound.cpp | 0 source/vba/{ => agb}/Sound.h | 0 source/vba/{ => agb}/Sram.cpp | 0 source/vba/{ => agb}/Sram.h | 0 source/vba/{ => agb}/armdis.cpp | 0 source/vba/{ => agb}/armdis.h | 0 source/vba/{ => agb}/bios.cpp | 0 source/vba/{ => agb}/bios.h | 0 source/vba/{ => agb}/elf.cpp | 0 source/vba/{ => agb}/elf.h | 0 source/vba/{ => common}/Patch.cpp | 0 source/vba/{ => common}/Patch.h | 0 source/vba/{ => common}/Port.h | 0 source/vba/{ => common}/memfile.cpp | 0 source/vba/{ => common}/memfile.h | 0 source/vba/{ => common}/memgzio.c | 0 source/vba/{ => common}/memgzio.h | 0 source/vba/interp.h | 302 --------------------------- source/vba/pixel.cpp | 150 ------------- source/vba/zutil.h | 220 ------------------- 38 files changed, 672 deletions(-) rename source/vba/{ => agb}/CheatSearch.cpp (100%) rename source/vba/{ => agb}/CheatSearch.h (100%) rename source/vba/{ => agb}/Cheats.cpp (100%) rename source/vba/{ => agb}/Cheats.h (100%) rename source/vba/{ => agb}/EEprom.cpp (100%) rename source/vba/{ => agb}/EEprom.h (100%) rename source/vba/{ => agb}/Flash.cpp (100%) rename source/vba/{ => agb}/Flash.h (100%) rename source/vba/{ => agb}/Globals.cpp (100%) rename source/vba/{ => agb}/Globals.h (100%) rename source/vba/{ => agb}/Mode0.cpp (100%) rename source/vba/{ => agb}/Mode1.cpp (100%) rename source/vba/{ => agb}/Mode2.cpp (100%) rename source/vba/{ => agb}/Mode3.cpp (100%) rename source/vba/{ => agb}/Mode4.cpp (100%) rename source/vba/{ => agb}/Mode5.cpp (100%) rename source/vba/{ => agb}/RTC.cpp (100%) rename source/vba/{ => agb}/RTC.h (100%) rename source/vba/{ => agb}/Sound.cpp (100%) rename source/vba/{ => agb}/Sound.h (100%) rename source/vba/{ => agb}/Sram.cpp (100%) rename source/vba/{ => agb}/Sram.h (100%) rename source/vba/{ => agb}/armdis.cpp (100%) rename source/vba/{ => agb}/armdis.h (100%) rename source/vba/{ => agb}/bios.cpp (100%) rename source/vba/{ => agb}/bios.h (100%) rename source/vba/{ => agb}/elf.cpp (100%) rename source/vba/{ => agb}/elf.h (100%) rename source/vba/{ => common}/Patch.cpp (100%) rename source/vba/{ => common}/Patch.h (100%) rename source/vba/{ => common}/Port.h (100%) rename source/vba/{ => common}/memfile.cpp (100%) rename source/vba/{ => common}/memfile.h (100%) rename source/vba/{ => common}/memgzio.c (100%) rename source/vba/{ => common}/memgzio.h (100%) delete mode 100644 source/vba/interp.h delete mode 100644 source/vba/pixel.cpp delete mode 100644 source/vba/zutil.h diff --git a/source/vba/CheatSearch.cpp b/source/vba/agb/CheatSearch.cpp similarity index 100% rename from source/vba/CheatSearch.cpp rename to source/vba/agb/CheatSearch.cpp diff --git a/source/vba/CheatSearch.h b/source/vba/agb/CheatSearch.h similarity index 100% rename from source/vba/CheatSearch.h rename to source/vba/agb/CheatSearch.h diff --git a/source/vba/Cheats.cpp b/source/vba/agb/Cheats.cpp similarity index 100% rename from source/vba/Cheats.cpp rename to source/vba/agb/Cheats.cpp diff --git a/source/vba/Cheats.h b/source/vba/agb/Cheats.h similarity index 100% rename from source/vba/Cheats.h rename to source/vba/agb/Cheats.h diff --git a/source/vba/EEprom.cpp b/source/vba/agb/EEprom.cpp similarity index 100% rename from source/vba/EEprom.cpp rename to source/vba/agb/EEprom.cpp diff --git a/source/vba/EEprom.h b/source/vba/agb/EEprom.h similarity index 100% rename from source/vba/EEprom.h rename to source/vba/agb/EEprom.h diff --git a/source/vba/Flash.cpp b/source/vba/agb/Flash.cpp similarity index 100% rename from source/vba/Flash.cpp rename to source/vba/agb/Flash.cpp diff --git a/source/vba/Flash.h b/source/vba/agb/Flash.h similarity index 100% rename from source/vba/Flash.h rename to source/vba/agb/Flash.h diff --git a/source/vba/Globals.cpp b/source/vba/agb/Globals.cpp similarity index 100% rename from source/vba/Globals.cpp rename to source/vba/agb/Globals.cpp diff --git a/source/vba/Globals.h b/source/vba/agb/Globals.h similarity index 100% rename from source/vba/Globals.h rename to source/vba/agb/Globals.h diff --git a/source/vba/Mode0.cpp b/source/vba/agb/Mode0.cpp similarity index 100% rename from source/vba/Mode0.cpp rename to source/vba/agb/Mode0.cpp diff --git a/source/vba/Mode1.cpp b/source/vba/agb/Mode1.cpp similarity index 100% rename from source/vba/Mode1.cpp rename to source/vba/agb/Mode1.cpp diff --git a/source/vba/Mode2.cpp b/source/vba/agb/Mode2.cpp similarity index 100% rename from source/vba/Mode2.cpp rename to source/vba/agb/Mode2.cpp diff --git a/source/vba/Mode3.cpp b/source/vba/agb/Mode3.cpp similarity index 100% rename from source/vba/Mode3.cpp rename to source/vba/agb/Mode3.cpp diff --git a/source/vba/Mode4.cpp b/source/vba/agb/Mode4.cpp similarity index 100% rename from source/vba/Mode4.cpp rename to source/vba/agb/Mode4.cpp diff --git a/source/vba/Mode5.cpp b/source/vba/agb/Mode5.cpp similarity index 100% rename from source/vba/Mode5.cpp rename to source/vba/agb/Mode5.cpp diff --git a/source/vba/RTC.cpp b/source/vba/agb/RTC.cpp similarity index 100% rename from source/vba/RTC.cpp rename to source/vba/agb/RTC.cpp diff --git a/source/vba/RTC.h b/source/vba/agb/RTC.h similarity index 100% rename from source/vba/RTC.h rename to source/vba/agb/RTC.h diff --git a/source/vba/Sound.cpp b/source/vba/agb/Sound.cpp similarity index 100% rename from source/vba/Sound.cpp rename to source/vba/agb/Sound.cpp diff --git a/source/vba/Sound.h b/source/vba/agb/Sound.h similarity index 100% rename from source/vba/Sound.h rename to source/vba/agb/Sound.h diff --git a/source/vba/Sram.cpp b/source/vba/agb/Sram.cpp similarity index 100% rename from source/vba/Sram.cpp rename to source/vba/agb/Sram.cpp diff --git a/source/vba/Sram.h b/source/vba/agb/Sram.h similarity index 100% rename from source/vba/Sram.h rename to source/vba/agb/Sram.h diff --git a/source/vba/armdis.cpp b/source/vba/agb/armdis.cpp similarity index 100% rename from source/vba/armdis.cpp rename to source/vba/agb/armdis.cpp diff --git a/source/vba/armdis.h b/source/vba/agb/armdis.h similarity index 100% rename from source/vba/armdis.h rename to source/vba/agb/armdis.h diff --git a/source/vba/bios.cpp b/source/vba/agb/bios.cpp similarity index 100% rename from source/vba/bios.cpp rename to source/vba/agb/bios.cpp diff --git a/source/vba/bios.h b/source/vba/agb/bios.h similarity index 100% rename from source/vba/bios.h rename to source/vba/agb/bios.h diff --git a/source/vba/elf.cpp b/source/vba/agb/elf.cpp similarity index 100% rename from source/vba/elf.cpp rename to source/vba/agb/elf.cpp diff --git a/source/vba/elf.h b/source/vba/agb/elf.h similarity index 100% rename from source/vba/elf.h rename to source/vba/agb/elf.h diff --git a/source/vba/Patch.cpp b/source/vba/common/Patch.cpp similarity index 100% rename from source/vba/Patch.cpp rename to source/vba/common/Patch.cpp diff --git a/source/vba/Patch.h b/source/vba/common/Patch.h similarity index 100% rename from source/vba/Patch.h rename to source/vba/common/Patch.h diff --git a/source/vba/Port.h b/source/vba/common/Port.h similarity index 100% rename from source/vba/Port.h rename to source/vba/common/Port.h diff --git a/source/vba/memfile.cpp b/source/vba/common/memfile.cpp similarity index 100% rename from source/vba/memfile.cpp rename to source/vba/common/memfile.cpp diff --git a/source/vba/memfile.h b/source/vba/common/memfile.h similarity index 100% rename from source/vba/memfile.h rename to source/vba/common/memfile.h diff --git a/source/vba/memgzio.c b/source/vba/common/memgzio.c similarity index 100% rename from source/vba/memgzio.c rename to source/vba/common/memgzio.c diff --git a/source/vba/memgzio.h b/source/vba/common/memgzio.h similarity index 100% rename from source/vba/memgzio.h rename to source/vba/common/memgzio.h diff --git a/source/vba/interp.h b/source/vba/interp.h deleted file mode 100644 index 0fd2961..0000000 --- a/source/vba/interp.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * This file is part of the Advance project. - * - * Copyright (C) 2003 Andrea Mazzoleni - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * In addition, as a special exception, Andrea Mazzoleni - * gives permission to link the code of this program with - * the MAME library (or with modified versions of MAME that use the - * same license as MAME), and distribute linked combinations including - * the two. You must obey the GNU General Public License in all - * respects for all of the code used other than MAME. If you modify - * this file, you may extend this exception to your version of the - * file, but you are not obligated to do so. If you do not wish to - * do so, delete this exception statement from your version. - */ - -#ifndef __INTERP_H -#define __INTERP_H - -#define __STDC_CONSTANT_MACROS - -#include - - -typedef uint16_t interp_uint16; -typedef uint32_t interp_uint32; - -/***************************************************************************/ -/* Basic types */ - -/***************************************************************************/ -/* interpolation */ - -static unsigned interp_mask[2]; -static unsigned interp_bits_per_pixel; - -#define INTERP_16_MASK_1(v) (v & interp_mask[0]) -#define INTERP_16_MASK_2(v) (v & interp_mask[1]) - -static inline u16 interp_16_521(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*2 + INTERP_16_MASK_1(p3)*1) / 8) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*2 + INTERP_16_MASK_2(p3)*1) / 8); -} - -static inline u16 interp_16_332(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)*2) / 8) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)*2) / 8); -} - -static inline u16 interp_16_611(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*6 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 8) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*6 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 8); -} - -static inline u16 interp_16_71(u16 p1, u16 p2) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*7 + INTERP_16_MASK_1(p2)) / 8) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*7 + INTERP_16_MASK_2(p2)) / 8); -} - -static inline u16 interp_16_211(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*2 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 4) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*2 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 4); -} - -static inline u16 interp_16_772(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1(((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2))*7 + INTERP_16_MASK_1(p3)*2) / 16) - | INTERP_16_MASK_2(((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2))*7 + INTERP_16_MASK_2(p3)*2) / 16); -} - -static inline u16 interp_16_11(u16 p1, u16 p2) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2)) / 2) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2)) / 2); -} - -static inline u16 interp_16_31(u16 p1, u16 p2) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)) / 4) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)) / 4); -} - -static inline u16 interp_16_1411(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*14 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 16) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*14 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 16); -} - -static inline u16 interp_16_431(u16 p1, u16 p2, u16 p3) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*4 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)) / 8) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*4 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)) / 8); -} - -static inline u16 interp_16_53(u16 p1, u16 p2) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*3) / 8) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*3) / 8); -} - -static inline u16 interp_16_151(u16 p1, u16 p2) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*15 + INTERP_16_MASK_1(p2)) / 16) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*15 + INTERP_16_MASK_2(p2)) / 16); -} - -static inline u16 interp_16_97(u16 p1, u16 p2) -{ - return INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*9 + INTERP_16_MASK_1(p2)*7) / 16) - | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*9 + INTERP_16_MASK_2(p2)*7) / 16); -} - -#define INTERP_32_MASK_1(v) (v & 0xFF00FF) -#define INTERP_32_MASK_2(v) (v & 0x00FF00) - -static inline u32 interp_32_521(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*2 + INTERP_32_MASK_1(p3)*1) / 8) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*2 + INTERP_32_MASK_2(p3)*1) / 8); -} - -static inline u32 interp_32_332(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)*2) / 8) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)*2) / 8); -} - -static inline u32 interp_32_211(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*2 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 4) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*2 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 4); -} - -static inline u32 interp_32_611(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*6 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 8) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*6 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 8); -} - -static inline u32 interp_32_71(u32 p1, u32 p2) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*7 + INTERP_32_MASK_1(p2)) / 8) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*7 + INTERP_32_MASK_2(p2)) / 8); -} - -static inline u32 interp_32_772(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1(((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2))*7 + INTERP_32_MASK_1(p3)*2) / 16) - | INTERP_32_MASK_2(((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2))*7 + INTERP_32_MASK_2(p3)*2) / 16); -} - -static inline u32 interp_32_11(u32 p1, u32 p2) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2)) / 2) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2)) / 2); -} - -static inline u32 interp_32_31(u32 p1, u32 p2) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)) / 4) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)) / 4); -} - -static inline u32 interp_32_1411(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*14 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 16) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*14 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 16); -} - -static inline u32 interp_32_431(u32 p1, u32 p2, u32 p3) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*4 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)) / 8) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*4 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)) / 8); -} - -static inline u32 interp_32_53(u32 p1, u32 p2) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*3) / 8) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*3) / 8); -} - -static inline u32 interp_32_151(u32 p1, u32 p2) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*15 + INTERP_32_MASK_1(p2)) / 16) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*15 + INTERP_32_MASK_2(p2)) / 16); -} - -static inline u32 interp_32_97(u32 p1, u32 p2) -{ - return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*9 + INTERP_32_MASK_1(p2)*7) / 16) - | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*9 + INTERP_32_MASK_2(p2)*7) / 16); -} - -/***************************************************************************/ -/* diff */ - -#define INTERP_Y_LIMIT (0x30*4) -#define INTERP_U_LIMIT (0x07*4) -#define INTERP_V_LIMIT (0x06*8) - -static int interp_16_diff(u16 p1, u16 p2) -{ - int r, g, b; - int y, u, v; - - if (p1 == p2) - return 0; - - if (interp_bits_per_pixel == 16) { - b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3; - g = (int)((p1 & 0x7E0) - (p2 & 0x7E0)) >> 3; - r = (int)((p1 & 0xF800) - (p2 & 0xF800)) >> 8; - } else { - b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3; - g = (int)((p1 & 0x3E0) - (p2 & 0x3E0)) >> 2; - r = (int)((p1 & 0x7C00) - (p2 & 0x7C00)) >> 7; - } - - y = r + g + b; - u = r - b; - v = -r + 2*g - b; - - if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT) - return 1; - - if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT) - return 1; - - if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT) - return 1; - - return 0; -} - -static int interp_32_diff(u32 p1, u32 p2) -{ - int r, g, b; - int y, u, v; - - if ((p1 & 0xF8F8F8) == (p2 & 0xF8F8F8)) - return 0; - - b = (int)((p1 & 0xFF) - (p2 & 0xFF)); - g = (int)((p1 & 0xFF00) - (p2 & 0xFF00)) >> 8; - r = (int)((p1 & 0xFF0000) - (p2 & 0xFF0000)) >> 16; - - y = r + g + b; - u = r - b; - v = -r + 2*g - b; - - if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT) - return 1; - - if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT) - return 1; - - if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT) - return 1; - - return 0; -} - -static void interp_set(unsigned bits_per_pixel) -{ - interp_bits_per_pixel = bits_per_pixel; - - switch (bits_per_pixel) { - case 15 : - interp_mask[0] = 0x7C1F; - interp_mask[1] = 0x03E0; - break; - case 16 : - interp_mask[0] = 0xF81F; - interp_mask[1] = 0x07E0; - break; - case 32 : - interp_mask[0] = 0xFF00FF; - interp_mask[1] = 0x00FF00; - break; - } -} - -#endif diff --git a/source/vba/pixel.cpp b/source/vba/pixel.cpp deleted file mode 100644 index 21a55a3..0000000 --- a/source/vba/pixel.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. -// Copyright (C) 1999-2003 Forgotten -// Copyright (C) 2004 Forgotten and the VBA development team - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2, or(at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include "System.h" - -extern int RGB_LOW_BITS_MASK; - -void Pixelate(u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ - u8 *nextLine, *finish; - u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16)); - - nextLine = dstPtr + dstPitch; - - do { - u32 *bP = (u32 *) srcPtr; - u32 *xP = (u32 *) deltaPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; - u32 currentDelta; - u32 nextDelta; - - finish = (u8 *) bP + ((width+2) << 1); - nextPixel = *bP++; - nextDelta = *xP++; - - do { - currentPixel = nextPixel; - currentDelta = nextDelta; - nextPixel = *bP++; - nextDelta = *xP++; - - if ((nextPixel != nextDelta) || (currentPixel != currentDelta)) { - u32 colorA, colorB, product; - - *(xP - 2) = currentPixel; -#ifdef WORDS_BIGENDIAN - colorA = currentPixel >> 16; - colorB = currentPixel & 0xffff; -#else - colorA = currentPixel & 0xffff; - colorB = currentPixel >> 16; -#endif - product = (((colorA & colorMask) >> 1) & colorMask) >> 1; - -#ifdef WORDS_BIGENDIAN - *(nL) = (product << 16) | (product); - *(dP) = (colorA << 16) | product; -#else - *(nL) = product | (product << 16); - *(dP) = colorA | (product << 16); -#endif - -#ifdef WORDS_BIGENDIAN - colorA = nextPixel >> 16; -#else - colorA = nextPixel & 0xffff; -#endif - product = (((colorB & colorMask) >> 1) & colorMask) >> 1; -#ifdef WORDS_BIGENDIAN - *(nL + 1) = (product << 16) | (product); - *(dP + 1) = (colorB << 16) | (product); -#else - *(nL + 1) = (product) | (product << 16); - *(dP + 1) = (colorB) | (product << 16); -#endif - } - - dP += 2; - nL += 2; - } while ((u8 *) bP < finish); - - deltaPtr += srcPitch; - srcPtr += srcPitch; - dstPtr += dstPitch << 1; - nextLine += dstPitch << 1; - } - while (--height); -} - -void Pixelate32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */, - u8 *dstPtr, u32 dstPitch, int width, int height) -{ - u8 *nextLine, *finish; - u32 colorMask = ~RGB_LOW_BITS_MASK; - - nextLine = dstPtr + dstPitch; - - do { - u32 *bP = (u32 *) srcPtr; - // u32 *xP = (u32 *) deltaPtr; - u32 *dP = (u32 *) dstPtr; - u32 *nL = (u32 *) nextLine; - u32 currentPixel; - u32 nextPixel; - - finish = (u8 *) bP + ((width+1) << 2); - nextPixel = *bP++; - - do { - currentPixel = nextPixel; - nextPixel = *bP++; - - u32 colorA, colorB, product; - - colorA = currentPixel; - colorB = nextPixel; - - product = (((colorA & colorMask) >> 1) & colorMask) >> 1; - *(nL) = product; - *(nL+1) = product; - *(dP) = colorA; - *(dP+1) = product; - - nextPixel = *bP++; - colorA = nextPixel; - product = (((colorB & colorMask) >> 1) & colorMask) >> 1; - *(nL + 2) = product; - *(nL + 3) = product; - *(dP + 2) = colorB; - *(dP + 3) = product; - - dP += 4; - nL += 4; - } while ((u8 *) bP < finish); - - srcPtr += srcPitch; - dstPtr += dstPitch << 1; - nextLine += dstPitch << 1; - } - while (--height); -} diff --git a/source/vba/zutil.h b/source/vba/zutil.h deleted file mode 100644 index 4726517..0000000 --- a/source/vba/zutil.h +++ /dev/null @@ -1,220 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id: zutil.h,v 1.2 2004/01/17 23:07:32 kxu Exp $ */ - -#ifndef _Z_UTIL_H -#define _Z_UTIL_H - -#include - -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H -extern int errno; -#else -# include -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - -/* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - -/* target dependencies */ - -#ifdef MSDOS -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) -/* Allow compilation with ANSI keywords only enabled */ -void _Cdecl farfree( void *block ); -void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -#endif - -#ifdef WIN32 /* Window 95 & Windows NT */ -# define OS_CODE 0x0b -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0F -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# define fdopen(fd,type) _fdopen(fd,type) -#endif - - -/* Common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - -/* functions */ - -#ifdef HAVE_STRERROR -extern char *strerror OF((int)); -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) -/* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else -extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); -extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); -extern void zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include -extern int z_verbose; -extern void z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, - uInt len)); -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* _Z_UTIL_H */