finish removing RandomizeMAC

This commit is contained in:
Arisotura 2022-09-15 21:44:24 +02:00
parent 648bf9fa7f
commit 455c996170
8 changed files with 18 additions and 24 deletions

View File

@ -80,7 +80,6 @@ enum ConfigEntry
Firm_Color,
Firm_Message,
Firm_MAC,
Firm_RandomizeMAC,
AudioBitrate,
};

View File

@ -406,6 +406,7 @@ void Reset()
if (rep)
{
mac[0] &= 0xFC; // ensure the MAC isn't a broadcast MAC
memcpy(&Firmware[0x36], mac, 6);
*(u16*)&Firmware[0x2A] = CRC16(&Firmware[0x2C], *(u16*)&Firmware[0x2C], 0x0000);

View File

@ -106,7 +106,6 @@ int FirmwareBirthdayDay;
int FirmwareFavouriteColour;
std::string FirmwareMessage;
std::string FirmwareMAC;
bool RandomizeMAC;
bool SocketBindAnyAddr;
std::string LANDevice;
@ -272,7 +271,6 @@ ConfigEntry ConfigFile[] =
{"FirmwareFavouriteColour", 0, &FirmwareFavouriteColour, 0},
{"FirmwareMessage", 2, &FirmwareMessage, (std::string)""},
{"FirmwareMAC", 2, &FirmwareMAC, (std::string)""},
{"RandomizeMAC", 1, &RandomizeMAC, false},
{"SockBindAnyAddr", 1, &SocketBindAnyAddr, false},
{"LANDevice", 2, &LANDevice, (std::string)""},

View File

@ -141,7 +141,6 @@ extern int FirmwareBirthdayDay;
extern int FirmwareFavouriteColour;
extern std::string FirmwareMessage;
extern std::string FirmwareMAC;
extern bool RandomizeMAC;
extern bool SocketBindAnyAddr;
extern std::string LANDevice;

View File

@ -64,10 +64,8 @@ FirmwareSettingsDialog::FirmwareSettingsDialog(QWidget* parent) : QDialog(parent
ui->overrideFirmwareBox->setChecked(Config::FirmwareOverrideSettings);
ui->txtMAC->setText(QString::fromStdString(Config::FirmwareMAC));
ui->cbRandomizeMAC->setChecked(Config::RandomizeMAC);
on_overrideFirmwareBox_toggled();
on_cbRandomizeMAC_toggled();
}
FirmwareSettingsDialog::~FirmwareSettingsDialog()
@ -135,7 +133,6 @@ void FirmwareSettingsDialog::done(int r)
std::string newMessage = ui->messageEdit->text().toStdString();
std::string newMAC = ui->txtMAC->text().toStdString();
bool newRandomizeMAC = ui->cbRandomizeMAC->isChecked();
if ( newOverride != Config::FirmwareOverrideSettings
|| newName != Config::FirmwareUsername
@ -144,8 +141,7 @@ void FirmwareSettingsDialog::done(int r)
|| newBirthdayDay != Config::FirmwareBirthdayDay
|| newBirthdayMonth != Config::FirmwareBirthdayMonth
|| newMessage != Config::FirmwareMessage
|| newMAC != Config::FirmwareMAC
|| newRandomizeMAC != Config::RandomizeMAC)
|| newMAC != Config::FirmwareMAC)
{
if (RunningSomething
&& QMessageBox::warning(this, "Reset necessary to apply changes",
@ -163,7 +159,6 @@ void FirmwareSettingsDialog::done(int r)
Config::FirmwareMessage = newMessage;
Config::FirmwareMAC = newMAC;
Config::RandomizeMAC = newRandomizeMAC;
Config::Save();
@ -210,9 +205,3 @@ void FirmwareSettingsDialog::on_overrideFirmwareBox_toggled()
ui->grpUserSettings->setDisabled(disable);
ui->grpWifiSettings->setDisabled(disable);
}
void FirmwareSettingsDialog::on_cbRandomizeMAC_toggled()
{
bool disable = ui->cbRandomizeMAC->isChecked();
ui->txtMAC->setDisabled(disable);
}

View File

@ -124,7 +124,6 @@ private slots:
void on_cbxBirthdayMonth_currentIndexChanged(int idx);
void on_overrideFirmwareBox_toggled();
void on_cbRandomizeMAC_toggled();
private:
bool verifyMAC();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>511</width>
<height>342</height>
<height>338</height>
</rect>
</property>
<property name="sizePolicy">
@ -144,9 +144,9 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="cbRandomizeMAC">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Randomize</string>
<string>(leave empty to use default MAC)</string>
</property>
</widget>
</item>

View File

@ -57,7 +57,7 @@ void IPCInit()
if (!IPCBuffer->attach())
{
printf("IPC sharedmem doesn't exist. creating\n");
if (!IPCBuffer->create(4096))
if (!IPCBuffer->create(1024))
{
printf("IPC sharedmem create failed :(\n");
delete IPCBuffer;
@ -89,7 +89,17 @@ void IPCInit()
void IPCDeInit()
{
if (IPCBuffer) delete IPCBuffer;
if (IPCBuffer)
{
IPCBuffer->lock();
u8* data = (u8*)IPCBuffer->data();
*(u16*)&data[0] &= ~(1<<IPCInstanceID);
IPCBuffer->unlock();
IPCBuffer->detach();
delete IPCBuffer;
}
IPCBuffer = nullptr;
}
@ -195,7 +205,6 @@ bool GetConfigBool(ConfigEntry entry)
case DSiSD_ReadOnly: return Config::DSiSDReadOnly != 0;
case DSiSD_FolderSync: return Config::DSiSDFolderSync != 0;
case Firm_RandomizeMAC: return Config::RandomizeMAC != 0;
case Firm_OverrideSettings: return Config::FirmwareOverrideSettings != 0;
}