mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 06:29:38 +00:00
Monitor type can be now specified from the command line.
This commit is contained in:
parent
793335d9b8
commit
fff597075d
@ -62,7 +62,7 @@ AMIC::AMIC()
|
||||
this->awacs->set_dma_out(this->snd_out_dma.get());
|
||||
|
||||
// initialize on-board video
|
||||
this->disp_id = std::unique_ptr<DisplayID> (new DisplayID(Disp_Id_Kind::AppleSense));
|
||||
this->disp_id = std::unique_ptr<DisplayID> (new DisplayID());
|
||||
}
|
||||
|
||||
bool AMIC::supports_type(HWCompType type) {
|
||||
|
@ -121,7 +121,7 @@ ATIRage::ATIRage(uint16_t dev_id, uint32_t vmem_size_mb)
|
||||
(asic_id << 24) | dev_id);
|
||||
|
||||
/* initialize display identification */
|
||||
this->disp_id = std::unique_ptr<DisplayID> (new DisplayID(Disp_Id_Kind::DDC2B));
|
||||
this->disp_id = std::unique_ptr<DisplayID> (new DisplayID());
|
||||
}
|
||||
|
||||
const char* ATIRage::get_reg_name(uint32_t reg_offset) {
|
||||
|
@ -23,14 +23,51 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <devices/video/displayid.h>
|
||||
#include <loguru.hpp>
|
||||
#include <machines/machineproperties.h>
|
||||
|
||||
DisplayID::DisplayID(Disp_Id_Kind id_kind)
|
||||
#include <cinttypes>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
/** Mapping between monitor IDs and their sense codes. */
|
||||
static const std::map<std::string, uint16_t> MonitorIdToCode = {
|
||||
{ "MacColor21in" , 0x00FF },
|
||||
{ "PortraitGS" , 0x01FF },
|
||||
{ "MacRGB12in" , 0x02FF },
|
||||
{ "TwoPageGS" , 0x03FF },
|
||||
{ "NTSC" , 0x04FF },
|
||||
{ "MacRGB15in" , 0x05FF },
|
||||
{ "HiRes12-14in" , 0x06FF },
|
||||
{ "Multiscan15in" , 0x0603 },
|
||||
{ "Multiscan17in" , 0x060B },
|
||||
{ "Multiscan20in" , 0x0623 },
|
||||
{ "AppleVision1710" , 0x062B }, // this code is assigned to several different monitors!
|
||||
{ "PALEncoder" , 0x0700 }, // no clue what it means
|
||||
{ "NTSCEncoder" , 0x0714 }, // no clue what it means
|
||||
{ "VGA-SVGA" , 0x0717 },
|
||||
{ "MacRGB16in" , 0x072D },
|
||||
{ "MacRGB19in" , 0x073A },
|
||||
{ "PAL" , 0x0730 },
|
||||
{ "NotConnected" , 0x07FF }
|
||||
};
|
||||
|
||||
DisplayID::DisplayID()
|
||||
{
|
||||
this->id_kind = id_kind;
|
||||
// assume a DDC monitor is connected by default
|
||||
this->id_kind = Disp_Id_Kind::DDC2B;
|
||||
|
||||
/* Initialize Apple monitor codes */
|
||||
this->std_sense_code = 6;
|
||||
this->ext_sense_code = 0x2B;
|
||||
std::string mon_id = GET_STR_PROP("mon_id");
|
||||
if (!mon_id.empty()) {
|
||||
if (MonitorIdToCode.count(mon_id)) {
|
||||
auto sense_code = MonitorIdToCode.at(mon_id);
|
||||
this->std_sense_code = (sense_code >> 8) & 0xFFU;
|
||||
this->ext_sense_code = (sense_code >> 0) & 0xFFU;
|
||||
this->id_kind = Disp_Id_Kind::AppleSense;
|
||||
LOG_F(INFO, "DisplayID mode set to AppleSense");
|
||||
LOG_F(INFO, "Standard sense code: 0x%d", this->std_sense_code);
|
||||
LOG_F(INFO, "Extended sense code: 0x%X", this->ext_sense_code);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize DDC I2C bus */
|
||||
this->next_state = I2CState::STOP;
|
||||
|
@ -55,7 +55,7 @@ enum I2CState : uint8_t {
|
||||
|
||||
class DisplayID {
|
||||
public:
|
||||
DisplayID(Disp_Id_Kind id_kind);
|
||||
DisplayID();
|
||||
~DisplayID() = default;
|
||||
|
||||
uint8_t read_monitor_sense(uint8_t levels, uint8_t dirs);
|
||||
|
@ -76,15 +76,27 @@ static const PropMap GossamerSettings = {
|
||||
new IntProperty( 0, vector<uint32_t>({0, 8, 16, 32, 64, 128, 256}))},
|
||||
{"gfxmem_size",
|
||||
new IntProperty( 2, vector<uint32_t>({2, 4, 6}))},
|
||||
{"mon_id",
|
||||
new StrProperty("")},
|
||||
{"fdd_img",
|
||||
new StrProperty("")},
|
||||
};
|
||||
|
||||
/** Monitors supported by the PDM on-board video. */
|
||||
/* see displayid.cpp for the full list of supported monitor IDs. */
|
||||
static const vector<string> PDMBuiltinMonitorIDs = {
|
||||
"PortraitGS", "MacRGB12in", "MacRGB15in", "HiRes12-14in", "VGA-SVGA",
|
||||
"MacRGB16in", "Multiscan15in", "Multiscan17in", "Multiscan20in",
|
||||
"NotConnected"
|
||||
};
|
||||
|
||||
static const PropMap PDMSettings = {
|
||||
{"rambank1_size",
|
||||
new IntProperty(0, vector<uint32_t>({0, 8, 16, 32, 64, 128}))},
|
||||
{"rambank2_size",
|
||||
new IntProperty(0, vector<uint32_t>({0, 8, 16, 32, 64, 128}))},
|
||||
{"mon_id",
|
||||
new StrProperty("HiRes12-14in", PDMBuiltinMonitorIDs)},
|
||||
{"fdd_img",
|
||||
new StrProperty("")},
|
||||
};
|
||||
@ -95,6 +107,7 @@ static const map<string, string> PropHelp = {
|
||||
{"rambank3_size", "specifies RAM bank 3 size in MB"},
|
||||
{"gfxmem_size", "specifies video memory size in MB"},
|
||||
{"fdd_img", "specifies path to floppy disk image"},
|
||||
{"mon_id", "specifies which monitor to emulate"},
|
||||
};
|
||||
|
||||
static const map<string, tuple<PropMap, function<int(string&)>, string>> machines = {
|
||||
@ -210,10 +223,20 @@ void list_properties() {
|
||||
for (auto& p : get<0>(mach.second)) {
|
||||
cout << setw(13) << p.first << "\t\t" << PropHelp.at(p.first)
|
||||
<< endl;
|
||||
if (p.second->get_type() == PROP_TYPE_INTEGER) {
|
||||
cout << setw(13) << "\t\t\t" "Valid values: " <<
|
||||
dynamic_cast<IntProperty*>(p.second)->get_valid_values_as_str()
|
||||
|
||||
cout << setw(13) << "\t\t\t" "Valid values: ";
|
||||
|
||||
switch(p.second->get_type()) {
|
||||
case PROP_TYPE_INTEGER:
|
||||
cout << dynamic_cast<IntProperty*>(p.second)->get_valid_values_as_str()
|
||||
<< endl;
|
||||
break;
|
||||
case PROP_TYPE_STRING:
|
||||
cout << dynamic_cast<StrProperty*>(p.second)->get_valid_values_as_str()
|
||||
<< endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user