839 posts
Location
England
Posted 24 June 2013 - 09:53 AM
Can anyone recommend a good bios replacement that supports OS selection?
I tried writing my own but I'm finding the process of looking back at the code then reinserting it into the CC zip and rebooting minecraft rather tedious, particularly when the VM behind CC won't give out what line the error is on.
After procrastinating and programming for so long in C#, I've finally decided to get back to working on my OS for CC and a nice bios selector would be handy, particularly one that will tell me the line number of any errors I make along the way.
7508 posts
Location
Australia
Posted 24 June 2013 - 10:07 AM
To test for errors, why don't you just run it on the computer as a program? That's what I plan on doing.
1604 posts
Posted 24 June 2013 - 10:33 AM
Well, I wrote a bios that supports multi-boot. I use it to test my own OS. Here's the
github repo.
Also, I recommend using an emulator (CCEmu or CCDesk) to test. It makes the development faster, since you don't have to go into minecraft, then into the computer, you just have all the computers there in one screen. And it saves some resources too ;)/>
839 posts
Location
England
Posted 25 June 2013 - 07:59 PM
To test for errors, why don't you just run it on the computer as a program? That's what I plan on doing.
Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.
Well, I wrote a bios that supports multi-boot. I use it to test my own OS. Here's the
github repo.
Also, I recommend using an emulator (CCEmu or CCDesk) to test. It makes the development faster, since you don't have to go into minecraft, then into the computer, you just have all the computers there in one screen. And it saves some resources too ;)/>
I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.
1604 posts
Posted 25 June 2013 - 09:41 PM
I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
I'm not sure what you mean. I never had any problem getting the line number for an error. And what do you mean by "the requirement of a rom file"?
That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.
Well, originally it didn't change or add any function. But I had to add that one, it's a protection that must be done on the bios. The only change with the native getmetatable is that it doesn't allow to get the string metatable. The string metatable is one for the whole Lua VM, so it's shared across computers. You don't want another computer changing your string functions, do you? :P/>
7508 posts
Location
Australia
Posted 25 June 2013 - 11:32 PM
Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.
I'm not saying run it there to make sure that it will work on a computer, I'm saying run it there to check for logic and syntax errors. If you have any, then it wouldn't matter where it is run, it will show up.
839 posts
Location
England
Posted 26 June 2013 - 09:18 AM
I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
I'm not sure what you mean. I never had any problem getting the line number for an error. And what do you mean by "the requirement of a rom file"?
If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.
That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.
Well, originally it didn't change or add any function. But I had to add that one, it's a protection that must be done on the bios. The only change with the native getmetatable is that it doesn't allow to get the string metatable. The string metatable is one for the whole Lua VM, so it's shared across computers. You don't want another computer changing your string functions, do you? :P/>
If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.
Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.
I'm not saying run it there to make sure that it will work on a computer, I'm saying run it there to check for logic and syntax errors. If you have any, then it wouldn't matter where it is run, it will show up.
Again, that won't combat the whole 'not giving line errors' problem if the error crops up mid-program. At least not without either explicitly adding extra pcalls or being able to replicate the issues undercraftOS. In which case if it's a relapse of accidentally using craftOS functions, that will lead to more cryptic problems regarding identifying that a craftOS-added function is the problem and where it is.
1604 posts
Posted 26 June 2013 - 01:00 PM
If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.
Ahhh, now I remember. Yeah, that was anoying :P/> I think I used another file that loaded the bios or something like that to test.
If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.
True, not sure why it's not done java-side. But still, I think it should be done, and the bios is the best place to do it (the only safe place to do it actually).
The __metatable way should work. Maybe they should do that java-side. Doing it on the bios would mean that you just need to do it once, since it's modified on every computer. I think I'll do that.
8543 posts
Posted 26 June 2013 - 01:25 PM
Keep the what-is-a-real-OS debate out of Ask a Pro.
839 posts
Location
England
Posted 27 June 2013 - 04:22 AM
Keep the what-is-a-real-OS debate out of Ask a Pro.
Was that actually directed at anyone?
If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.
Ahhh, now I remember. Yeah, that was anoying :P/> I think I used another file that loaded the bios or something like that to test.
If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.
True, not sure why it's not done java-side. But still, I think it should be done, and the bios is the best place to do it (the only safe place to do it actually).
The __metatable way should work. Maybe they should do that java-side. Doing it on the bios would mean that you just need to do it once, since it's modified on every computer. I think I'll do that.
I may try that. I'm a tad rusty because I've been busy on other non-lua projects, so I keep forgetting what the return values of things like loadstring are. :P/>
Personally I think the 'bios' is a stage too late and something that crucial should be Java-side. If it were any normal lua VM I'd say it was fine but given this VM's usage, it's better to be safe than sorry.
Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.
1604 posts
Posted 27 June 2013 - 12:21 PM
Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.
It's worked so far. You can't get the string metatable, but it doesn't error like the other method did (wich can be good in some cases, bad in some others). I haven't found any way to bypass this, but that doesn't mean there isn't. Will keep testing that.
The only "problem" I found is that you can't set the metatable for strings (also, it will error if you try). But, who does that anyway? :P/>
8543 posts
Posted 27 June 2013 - 01:37 PM
Keep the what-is-a-real-OS debate out of Ask a Pro.
Was that actually directed at anyone?
Of course.
Because functions get changed and added as part of CraftOS's loading up. If the OS is reliant on anything generated by CraftOS, it's not a true OS because it requires another OS to load first.
Emphasis mine. The first sentence was fine, the second is not welcome here, as it's completely opinion-based, irrelevant to the discussion, and plays into a recurring debate.
839 posts
Location
England
Posted 28 June 2013 - 12:37 PM
Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.
It's worked so far. You can't get the string metatable, but it doesn't error like the other method did (wich can be good in some cases, bad in some others). I haven't found any way to bypass this, but that doesn't mean there isn't. Will keep testing that.
The only "problem" I found is that you can't set the metatable for strings (also, it will error if you try). But, who does that anyway? :P/>
I think not erroring is a better idea personally. Errors and exceptions do make things less cryptic, but on the other hand there's a performance cost for handling them. It's one thing I think C/C++ has/had right (returning null pointers if something didn't allocate properly). I wouldn't go as far to say the whole error thing is a bad idea, I just think there are some times where errors are better handled with single if statements than multi-line pcalls.
It's something I've considered experimenting with to see how much I can break, but otherwise, nobody lol