libs: obj/libmusashi.a obj/libjaguarcore.a
@echo -e "\033[01;33m***\033[00;32m Libraries successfully made.\033[00m"
-obj/libmusashi.a: musashi.mak
+obj/libmusashi.a: musashi.mak sources
@echo -e "\033[01;33m***\033[00;32m Making Musashi...\033[00m"
$(MAKE) -f musashi.mak
-obj/libjaguarcore.a: jaguarcore.mak
+obj/libjaguarcore.a: jaguarcore.mak sources
@echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar core...\033[00m"
$(MAKE) -f jaguarcore.mak
//
-// filepicker.cpp - A ROM chooser
+// filelistmodel.cpp - A ROM chooser
//
// by James L. Hammons
// (C) 2010 Underground Software
// Who When What
// --- ---------- -------------------------------------------------------------
// JLH 02/01/2010 Created this file
+// JLH 07/05/2011 Fixed model to not reset itself with each new row insertion
//
// Note that we have to put in convenience functions to the model for adding data
int FileListModel::rowCount(const QModelIndex & parent/*= QModelIndex()*/) const
{
-// return pixList.size();
-// return dbIndex.size();
return list.size();
}
QVariant FileListModel::data(const QModelIndex & index, int role) const
{
-// return QVariant();
-// return pixList.at(index.row());
-// return (uint)dbIndex.at(index.row());
-//It could be that this is fucking things up...
-#if 0
- if (role == Qt::DecorationRole)
- return list.at(index.row()).label;
- else if (role == Qt::DisplayRole)
- return (uint)list.at(index.row()).dbIndex;
- else if (role == Qt::EditRole)
- return list.at(index.row()).filename;
- else if (role == Qt::WhatsThisRole)
- return (uint)list.at(index.row()).fileSize;
- else
- return QVariant();
-#else
if (role == FLM_LABEL)
return list.at(index.row()).label;
else if (role == FLM_INDEX)
return (uint)list.at(index.row()).crc;
return QVariant();
-#endif
}
QVariant FileListModel::headerData(int/* section*/, Qt::Orientation/* orientation*/, int role/*= Qt::DisplayRole*/) const
{
-#if 0
- // Not sure that this is necessary for our purposes...
- // Especially since this model would never make use of this info...
- if (role != Qt::DisplayRole)
- return QVariant();
-
- if (orientation == Qt::Horizontal)
- return QString("Column %1").arg(section);
- else
- return QString("Row %1").arg(section);
-#else
// This seems more like what we want...
if (role == Qt::SizeHintRole)
return QSize(1, 1);
return QVariant();
-#endif
}
-/*
-void FileListModel::AddData(QIcon pix)
-{
- pixList.push_back(pix);
- reset();
-}
-
-void FileListModel::AddData(unsigned long index)
-{
- dbIndex.push_back(index);
- reset();
-}
-*/
-
void FileListModel::AddData(unsigned long index, QString str, QImage img, unsigned long size)
{
// Assuming that both QString and QImage have copy constructors, this should work.
data.filename = str;
data.label = img;
+ // Let's try this:
+ beginInsertRows(QModelIndex(), list.size(), list.size());
list.push_back(data);
- reset();
+ endInsertRows();
}
void FileListModel::AddData(unsigned long index, QString str, QImage img, unsigned long size, bool univHdr, uint32_t type, uint32_t fileCrc)
data.fileType = type;
data.crc = fileCrc;
+ // Let's try this:
+ beginInsertRows(QModelIndex(), list.size(), list.size());
list.push_back(data);
-//This is probably not the best way to do this, it prevents the user from using the
-//list while it populates.
-#warning "!!! AddData calls reset() for every addition, this is bad !!!"
- reset();
+ endInsertRows();
}
void FileListModel::ClearData(void)
//{
// return list.at(index.row());
//}
-
-#if 0
-
-class StringListModel : public QAbstractListModel
-{
- Q_OBJECT
-
- public:
- StringListModel(const QStringList &strings, QObject *parent = 0)
- : QAbstractListModel(parent), stringList(strings) {}
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role) const;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
-
- private:
- QStringList stringList;
-};
-
-int StringListModel::rowCount(const QModelIndex &parent) const
-{
- return stringList.count();
-}
-
-QVariant StringListModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (index.row() >= stringList.size())
- return QVariant();
-
- if (role == Qt::DisplayRole)
- return stringList.at(index.row());
- else
- return QVariant();
-}
-
-
-QVariant StringListModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (role != Qt::DisplayRole)
- return QVariant();
-
- if (orientation == Qt::Horizontal)
- return QString("Column %1").arg(section);
- else
- return QString("Row %1").arg(section);
-}
-
-
-
- void ImageModel::setImage(const QImage &image)
- {
- modelImage = image;
- reset();
- }
-
-The QAbstractItemModel::reset() call tells the view(s) that the model has changed.
-
-#endif
printf("VSB size width: %u\n", sbWidth);
int sbWidth2 = vsb->sizeHint().width();
printf("VSB sizeHint width: %u\n", sbWidth2);
+ int sbWidth3 = vsb->minimumSize().width();
+ printf("VSB minimum width: %u\n", sbWidth3);
+ int sbWidth4 = vsb->frameSize().width();
+ printf("VSB frame width: %u\n", sbWidth4);
delete vsb;
+// fileList->setFixedWidth((488/4) + 4);
+ int sbWidth5 = fileList->frameWidth();
+ printf("List frame width: %u, (diff=%d)\n", sbWidth5, sbWidth5 - ((488/4) + 4));
+ int sbWidth6 = fileList->sizeHint().width();
+ printf("List sizeHint width: %u\n", sbWidth6);
+ int sbWidth7 = fileList->minimumSize().width();
+ printf("List minimum width: %u\n", sbWidth7);
+ int sbWidth8 = fileList->minimumSizeHint().width();
+ printf("List minimum hint width: %u\n", sbWidth8);
// fileList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
// fileList->verticalScrollBar()->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+ // (488/4) + 4 is the width of the object in the filelistmodel. Dunno why the QListView
+ // isn't picking that up. :-(
fileList->setFixedWidth((488/4) + 4 + sbWidth);//ick
+// fileList->setFixedWidth((488/4) + 4 + 17 + 4);//sbWidth);//ick
+
+// fileList->setSpacing(4);
+ fileList->setUniformItemSizes(true);
#endif
// QVBoxLayout * layout = new QVBoxLayout;
connect(insertCart, SIGNAL(clicked()), this, SLOT(LoadButtonPressed()));
}
+void FilePickerWindow::keyPressEvent(QKeyEvent * e)
+{
+ if (e->key() == Qt::Key_Escape)
+ hide();
+ else if (e->key() == Qt::Key_Return)
+ LoadButtonPressed();
+}
+
QString FilePickerWindow::GetSelectedPrettyName(void)
{
return prettyFilename;
void FilePickerWindow::AddFileToList3(unsigned long index, QString str, QImage * img, unsigned long size, bool haveUniversalHeader, unsigned long fileType, unsigned long crc)
{
-if (index != 0xFFFFFFFF)
- printf("FilePickerWindow(3): Found match [%s]...\n", romList[index].name);
+//if (index != 0xFFFFFFFF)
+// printf("FilePickerWindow(3): Found match [%s]...\n", romList[index].name);
if (img)
{
{
// TODO: Get the text of the current selection, call the MainWin slot for loading
emit(RequestLoad(currentFile));
- this->hide();
+ hide();
}
//
void RequestLoad(QString);
protected:
+ void keyPressEvent(QKeyEvent *);
// void PopulateList(void);
private:
// FIXED:
//
+// - Add dbl click/enter to select in cart list, ESC to dimiss [DONE]
//
// STILL TO BE DONE:
//
// - Controller configuration
// - Remove SDL dependencies (sound, mainly) from Jaguar core lib
// - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting with 'R', etc)
-// - Add dbl click/enter to select in cart list, ESC to dimiss
//
/*
pauseAct->setDisabled(true);
showUntunedTankCircuit = true;
running = true;
+ // This is just in case the ROM we were playing was in a narrow or wide field mode
+ TOMReset();
}
else
{
uint64 p0 = OPLoadPhrase(op_pointer);
//WriteLog("\t%08X type %i\n", op_pointer, (uint8)p0 & 0x07);
op_pointer += 8;
+
+#if 1
if (scanline == TOMGetVDB() && op_start_log)
//if (scanline == 215 && op_start_log)
//if (scanline == 28 && op_start_log)
+//if (scanline == 0)
{
WriteLog("%08X --> phrase %08X %08X", op_pointer - 8, (int)(p0>>32), (int)(p0&0xFFFFFFFF));
if ((p0 & 0x07) == OBJECT_TYPE_BITMAP)
WriteLog("\n");
}
if ((p0 & 0x07) == OBJECT_TYPE_STOP)
-WriteLog(" --> List end\n");
-}//*/
+WriteLog(" --> List end\n\n");
+}
+#endif
switch ((uint8)p0 & 0x07)
{
//No, the reason this was needed is that the OP code before was wrong. Any value
//less than VDB will get written to the top line of the display!
-// if (ypos == 0)
-// ypos = TOMReadWord(0xF00046, OP) / 2; // Get the VDB value
+#if 0
+// Not so sure... Let's see what happens here...
+// No change...
+ if (ypos == 0)
+ ypos = TOMReadWord(0xF00046, OP) / 2; // Get the VDB value
+#endif
+// Actually, no. Any item less than VDB will get only the lines that hang over VDB displayed.
+// So we need to fix this somehow...
+
uint32 height = (p0 & 0xFFC000) >> 14;
uint32 oldOPP = op_pointer - 8;
// *** BEGIN OP PROCESSOR TESTING ONLY ***
uint16 ypos = (p0 >> 3) & 0x7FF;
uint32 height = (p0 & 0xFFC000) >> 14;
uint32 oldOPP = op_pointer - 8;
+//WriteLog("OP: Scaled Object (ypos=%04X, height=%04X", ypos, height);
// *** BEGIN OP PROCESSOR TESTING ONLY ***
if (inhibit && op_start_log)
{
// OP write-backs
- uint8 remainder = p2 >> 16, vscale = p2 >> 8;
+ uint16 remainder = (p2 >> 16) & 0xFF;//, vscale = p2 >> 8;
+ uint8 /*remainder = p2 >> 16,*/ vscale = p2 >> 8;
//Actually, we should skip this object if it has a vscale of zero.
//Or do we? Not sure... Atari Karts has a few lines that look like:
// (SCALED BITMAP)
// [7 (0) x 1 @ (13, 0) (8 bpp), l: 000E82A0, p: 000E0FC0 fp: 00, fl:RELEASE, idx:00, pt:01]
// [hsc: 9A, vsc: 00, rem: 00]
// Could it be the vscale is overridden if the DWIDTH is zero? Hmm...
+//WriteLog("OP: Scaled bitmap processing (rem=%02X, vscale=%02X)...\n", remainder, vscale);//*/
if (vscale == 0)
vscale = 0x20; // OP bug??? Nope, it isn't...! Or is it?
// if ((remainder - 1) >= 0xE0) // I.e., it's <= 0
// if ((remainder >= 0xE1) || remainder == 0)// I.e., it's <= 0
// if ((remainder >= 0xE1 && remainder <= 0xFF) || remainder == 0)// I.e., it's <= 0
- if (remainder <= 0x20) // I.e., it's <= 0
+// if (remainder <= 0x20) // I.e., it's <= 1.0
+ // I.e., it's < 1.0f -> means it'll go negative when we subtract 1.0f.
+ if (remainder < 0x20)
{
uint64 data = (p0 & 0xFFFFF80000000000LL) >> 40;
uint64 dwidth = (p1 & 0xFFC0000) >> 15;
// while ((remainder - 1) >= 0xE0)
// while ((remainder >= 0xE1) || remainder == 0)
// while ((remainder >= 0xE1 && remainder <= 0xFF) || remainder == 0)
- while (remainder <= 0x20)
+// while (remainder <= 0x20)
+ while (remainder < 0x20)
{
remainder += vscale;
p2 &= ~0x0000000000FF0000LL;
p2 |= (uint64)remainder << 16;
//WriteLog("%08X%08X]\n", (uint32)(p2>>32), (uint32)(p2&0xFFFFFFFF));
- OPStorePhrase(oldOPP+16, p2);
+ OPStorePhrase(oldOPP + 16, p2);
//remainder = (uint8)(p2 >> 16), vscale = (uint8)(p2 >> 8);
//WriteLog(" [after]: rem=%02X, vscale=%02X\n", remainder, vscale);
}
+
op_pointer = (p0 & 0x000007FFFF000000LL) >> 21;
break;
}
current_line_buffer++;
uint32 b = *current_line_buffer++;
//hm. *backbuffer++ = 0xFF000000 | (b << 16) | (g << 8) | r;
- *backbuffer++ = 0x000000FF | (r << 24) | (g << 16) | (r << 8);
+ *backbuffer++ = 0x000000FF | (r << 24) | (g << 16) | (b << 8);
width--;
}
}
if (scanline & 0x01) // Execute OP only on even lines (non-interlaced only!)
return;
+//Hm, it seems that the OP needs to execute from zero, so let's try it:
+// And it works! But need to do some optimizations in the OP to keep it from attempting
+// to do a scanline render in the non-display area... [DONE]
+#if 0
if (scanline >= (uint16)GET16(tomRam8, VDB) && scanline < (uint16)GET16(tomRam8, VDE))
{
if (render)
}
else
inActiveDisplayArea = false;
+#else
+ inActiveDisplayArea =
+ (scanline >= (uint16)GET16(tomRam8, VDB) && scanline < (uint16)GET16(tomRam8, VDE)
+ ? true : false);
+
+ if (scanline < (uint16)GET16(tomRam8, VDE))
+ {
+ if (render)//With JaguarExecuteNew() this is always true...
+ {
+ uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800];
+ uint8 bgHI = tomRam8[BG], bgLO = tomRam8[BG + 1];
+
+ // Clear line buffer with BG
+ if (GET16(tomRam8, VMODE) & BGEN) // && (CRY or RGB16)...
+ for(uint32 i=0; i<720; i++)
+ *current_line_buffer++ = bgHI, *current_line_buffer++ = bgLO;
+
+// OPProcessList(scanline, render);
+//This seems to take care of it...
+ OPProcessList(scanline, inActiveDisplayArea);
+ }
+ }
+#endif
// Try to take PAL into account...